// Contributors:
//  Mark Pilgrim (http://diveintomark.org/)
//
// For details, see the script.aculo.us web site: http://script.aculo.us/
// returns self (or first argument) if not convertable
if (typeof Effect == 'undefined') {
    String.prototype.parseColor = function () {
        var color = '#';
        if (this.slice(0, 4) == 'rgb(') {
            var cols = this.slice(4, this.length - 1).split(',');
            var i = 0;
            do {
                color += parseInt(cols[i]).toColorPart()
            } while (++i < 3);
        } else {
            if (this.slice(0, 1) == '#') {
                if (this.length == 4) for (var i = 1; i < 4; i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
                if (this.length == 7) color = this.toLowerCase();
            }
        }
        return (color.length == 7 ? color : (arguments[0] || this));
    };
    Element.collectTextNodes = function (element) {
        return $A($(element).childNodes).collect(function (node) {
            return (node.nodeType == 3 ? node.nodeValue :
                (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
        }).flatten().join('');
    };
    Element.collectTextNodesIgnoreClass = function (element, className) {
        return $A($(element).childNodes).collect(function (node) {
            return (node.nodeType == 3 ? node.nodeValue :
                ((node.hasChildNodes() && !Element.hasClassName(node, className)) ?
                Element.collectTextNodesIgnoreClass(node, className) : ''));
        }).flatten().join('');
    };
    Element.setContentZoom = function (element, percent) {
        element = $(element);
        element.setStyle({
            fontSize: (percent / 100) + 'em'
        });
        if (Prototype.Browser.WebKit) window.scrollBy(0, 0);
        return element;
    };
    Element.getInlineOpacity = function (element) {
        return $(element).style.opacity || '';
    };
    Element.forceRerendering = function (element) {
        try {
            element = $(element);
            var n = document.createTextNode(' ');
            element.appendChild(n);
            element.removeChild(n);
        } catch (e) {}
    };
    var Effect = {
        _elementDoesNotExistError: {
            name: 'ElementDoesNotExistError',
            message: 'The specified DOM element does not exist, but is required for this effect to operate'
        },
        Transitions: {
            linear: Prototype.K,
            sinoidal: function (pos) {
                return (-Math.cos(pos * Math.PI) / 2) + .5;
            },
            reverse: function (pos) {
                return 1 - pos;
            },
            flicker: function (pos) {
                var pos = ((-Math.cos(pos * Math.PI) / 4) + .75) + Math.random() / 4;
                return pos > 1 ? 1 : pos;
            },
            wobble: function (pos) {
                return (-Math.cos(pos * Math.PI * (9 * pos)) / 2) + .5;
            },
            pulse: function (pos, pulses) {
                return (-Math.cos((pos * ((pulses || 5) - .5) * 2) * Math.PI) / 2) + .5;
            },
            spring: function (pos) {
                return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
            },
            none: function (pos) {
                return 0;
            },
            full: function (pos) {
                return 1;
            }
        },
        DefaultOptions: {
            duration: 1.0, // seconds
            fps: 100, // 100= assume 66fps max.
            sync: false, // true for combining
            from: 0.0,
            to: 1.0,
            delay: 0.0,
            queue: 'parallel'
        },
        tagifyText: function (element) {
            var tagifyStyle = 'position:relative';
            if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
            element = $(element);
            $A(element.childNodes).each(function (child) {
                if (child.nodeType == 3) {
                    child.nodeValue.toArray().each(function (character) {
                        element.insertBefore(
                        new Element('span', {
                            style: tagifyStyle
                        }).update(
                        character == ' ' ? String.fromCharCode(160) : character),
                        child);
                    });
                    Element.remove(child);
                }
            });
        },
        multiple: function (element, effect) {
            var elements;
            if (((typeof element == 'object') ||
                Object.isFunction(element)) &&
                (element.length))
                elements = element;
            else
                elements = $(element).childNodes;
            var options = Object.extend({
                speed: 0.1,
                delay: 0.0
            }, arguments[2] || {});
            var masterDelay = options.delay;
            $A(elements).each(function (element, index) {
                new effect(element, Object.extend(options, {
                    delay: index * options.speed + masterDelay
                }));
            });
        },
        PAIRS: {
            'slide': ['SlideDown', 'SlideUp'],
            'blind': ['BlindDown', 'BlindUp'],
            'appear': ['Appear', 'Fade']
        },
        toggle: function (element, effect) {
            element = $(element);
            effect = (effect || 'appear').toLowerCase();
            var options = Object.extend({
                queue: {
                    position: 'end',
                    scope: (element.id || 'global'),
                    limit: 1
                }
            }, arguments[2] || {});
            Effect[element.visible() ?
                Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
        }
    };
    Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;
    Effect.ScopedQueue = Class.create(Enumerable, {
        initialize: function () {
            this.effects = [];
            this.interval = null;
        },
        _each: function (iterator) {
            this.effects._each(iterator);
        },
        add: function (effect) {
            var timestamp = new Date().getTime();
            var position = Object.isString(effect.options.queue) ?
                effect.options.queue : effect.options.queue.position;
            switch (position) {
                case 'front':
                    this.effects.findAll(function (e) {
                        return e.state == 'idle'
                    }).each(function (e) {
                        e.startOn += effect.finishOn;
                        e.finishOn += effect.finishOn;
                    });
                    break;
                case 'with-last':
                    timestamp = this.effects.pluck('startOn').max() || timestamp;
                    break;
                case 'end':
                    timestamp = this.effects.pluck('finishOn').max() || timestamp;
                    break;
            }
            effect.startOn += timestamp;
            effect.finishOn += timestamp;
            if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
                this.effects.push(effect);
            if (!this.interval)
                this.interval = setInterval(this.loop.bind(this), 15);
        },
        remove: function (effect) {
            this.effects = this.effects.reject(function (e) {
                return e == effect
            });
            if (this.effects.length == 0) {
                clearInterval(this.interval);
                this.interval = null;
            }
        },
        loop: function () {
            var timePos = new Date().getTime();
            for (var i = 0, len = this.effects.length; i < len; i++)
                this.effects[i] && this.effects[i].loop(timePos);
        }
    });
    Effect.Queues = {
        instances: $H(),
        get: function (queueName) {
            if (!Object.isString(queueName)) return queueName;
            return this.instances.get(queueName) ||
                this.instances.set(queueName, new Effect.ScopedQueue());
        }
    };
    Effect.Queue = Effect.Queues.get('global');
    Effect.Base = Class.create({
        position: null,
        start: function (options) {
            function codeForEvent(options, eventName) {
                return (
                (options[eventName + 'Internal'] ? 'this.options.' + eventName + 'Internal(this);' : '') +
                    (options[eventName] ? 'this.options.' + eventName + '(this);' : ''));
            }
            if (options && options.transition === false) options.transition = Effect.Transitions.linear;
            this.options = Object.extend(Object.extend({}, Effect.DefaultOptions), options || {});
            this.currentFrame = 0;
            this.state = 'idle';
            this.startOn = this.options.delay * 1000;
            this.finishOn = this.startOn + (this.options.duration * 1000);
            this.fromToDelta = this.options.to - this.options.from;
            this.totalTime = this.finishOn - this.startOn;
            this.totalFrames = this.options.fps * this.options.duration;
            this.render = (function () {
                function dispatch(effect, eventName) {
                    if (effect.options[eventName + 'Internal'])
                        effect.options[eventName + 'Internal'](effect);
                    if (effect.options[eventName])
                        effect.options[eventName](effect);
                }
                return function (pos) {
                    if (this.state === "idle") {
                        this.state = "running";
                        dispatch(this, 'beforeSetup');
                        if (this.setup) this.setup();
                        dispatch(this, 'afterSetup');
                    }
                    if (this.state === "running") {
                        pos = (this.options.transition(pos) * this.fromToDelta) + this.options.from;
                        this.position = pos;
                        dispatch(this, 'beforeUpdate');
                        if (this.update) this.update(pos);
                        dispatch(this, 'afterUpdate');
                    }
                };
            })();
            this.event('beforeStart');
            if (!this.options.sync)
                Effect.Queues.get(Object.isString(this.options.queue) ?
                    'global' : this.options.queue.scope).add(this);
        },
        loop: function (timePos) {
            if (timePos >= this.startOn) {
                if (timePos >= this.finishOn) {
                    this.render(1.0);
                    this.cancel();
                    this.event('beforeFinish');
                    if (this.finish) this.finish();
                    this.event('afterFinish');
                    return;
                }
                var pos = (timePos - this.startOn) / this.totalTime,
                    frame = (pos * this.totalFrames).round();
                if (frame > this.currentFrame) {
                    this.render(pos);
                    this.currentFrame = frame;
                }
            }
        },
        cancel: function () {
            if (!this.options.sync)
                Effect.Queues.get(Object.isString(this.options.queue) ?
                    'global' : this.options.queue.scope).remove(this);
            this.state = 'finished';
        },
        event: function (eventName) {
            if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
            if (this.options[eventName]) this.options[eventName](this);
        },
        inspect: function () {
            var data = $H();
            for (property in this)
                if (!Object.isFunction(this[property])) data.set(property, this[property]);
            return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
        }
    });
    Effect.Parallel = Class.create(Effect.Base, {
        initialize: function (effects) {
            this.effects = effects || [];
            this.start(arguments[1]);
        },
        update: function (position) {
            this.effects.invoke('render', position);
        },
        finish: function (position) {
            this.effects.each(function (effect) {
                effect.render(1.0);
                effect.cancel();
                effect.event('beforeFinish');
                if (effect.finish) effect.finish(position);
                effect.event('afterFinish');
            });
        }
    });
    Effect.Tween = Class.create(Effect.Base, {
        initialize: function (object, from, to) {
            object = Object.isString(object) ? $(object) : object;
            var args = $A(arguments),
                method = args.last(),
                options = args.length == 5 ? args[3] : null;
            this.method = Object.isFunction(method) ? method.bind(object) :
                Object.isFunction(object[method]) ? object[method].bind(object) : function (value) {
                object[method] = value
            };
            this.start(Object.extend({
                from: from,
                to: to
            }, options || {}));
        },
        update: function (position) {
            this.method(position);
        }
    });
    Effect.Event = Class.create(Effect.Base, {
        initialize: function () {
            this.start(Object.extend({
                duration: 0
            }, arguments[0] || {}));
        },
        update: Prototype.emptyFunction
    });
    Effect.Opacity = Class.create(Effect.Base, {
        initialize: function (element) {
            this.element = $(element);
            if (!this.element) throw (Effect._elementDoesNotExistError)
            if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
                this.element.setStyle({
                    zoom: 1
                });
            var options = Object.extend({
                from: this.element.getOpacity() || 0.0,
                to: 1.0
            }, arguments[1] || {});
            this.start(options);
        },
        update: function (position) {
            this.element.setOpacity(position);
        }
    });
    Effect.Move = Class.create(Effect.Base, {
        initialize: function (element) {
            this.element = $(element);
            if (!this.element) throw (Effect._elementDoesNotExistError);
            var options = Object.extend({
                x: 0,
                y: 0,
                mode: 'relative'
            }, arguments[1] || {});
            this.start(options);
        },
        setup: function () {
            this.element.makePositioned();
            this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
            this.originalTop = parseFloat(this.element.getStyle('top') || '0');
            if (this.options.mode == 'absolute') {
                this.options.x = this.options.x - this.originalLeft;
                this.options.y = this.options.y - this.originalTop;
            }
        },
        update: function (position) {
            this.element.setStyle({
                left: (this.options.x * position + this.originalLeft).round() + 'px',
                top: (this.options.y * position + this.originalTop).round() + 'px'
            });
        }
    })
    Effect.MoveBy = function (element, toTop, toLeft) {
        return new Effect.Move(element,
        Object.extend({
            x: toLeft,
            y: toTop
        }, arguments[3] || {}));
    };
    Effect.Scale = Class.create(Effect.Base, {
        initialize: function (element, percent) {
            this.element = $(element);
            if (!this.element) throw (Effect._elementDoesNotExistError);
            var options = Object.extend({
                scaleX: true,
                scaleY: true,
                scaleContent: true,
                scaleFromCenter: false,
                scaleMode: 'box', // 'box' or 'contents' or { } with provided values
                scaleFrom: 100.0,
                scaleTo: percent
            }, arguments[2] || {});
            this.start(options);
        },
        setup: function () {
            this.restoreAfterFinish = this.options.restoreAfterFinish || false;
            this.elementPositioning = this.element.getStyle('position');
            this.originalStyle = {};
            ['top', 'left', 'width', 'height', 'fontSize'].each(function (k) {
                this.originalStyle[k] = this.element.style[k];
            }.bind(this));
            this.originalTop = this.element.offsetTop;
            this.originalLeft = this.element.offsetLeft;
            var fontSize = this.element.getStyle('font-size') || '100%';
            ['em', 'px', '%', 'pt'].each(function (fontSizeType) {
                if (fontSize.indexOf(fontSizeType) > 0) {
                    this.fontSize = parseFloat(fontSize);
                    this.fontSizeType = fontSizeType;
                }
            }.bind(this));
            this.factor = (this.options.scaleTo - this.options.scaleFrom) / 100;
            this.dims = null;
            if (this.options.scaleMode == 'box')
                this.dims = [this.element.offsetHeight, this.element.offsetWidth];
            if (/^content/.test(this.options.scaleMode))
                this.dims = [this.element.scrollHeight, this.element.scrollWidth];
            if (!this.dims)
                this.dims = [this.options.scaleMode.originalHeight,
                    this.options.scaleMode.originalWidth
                ];
        },
        update: function (position) {
            var currentScale = (this.options.scaleFrom / 100.0) + (this.factor * position);
            if (this.options.scaleContent && this.fontSize)
                this.element.setStyle({
                    fontSize: this.fontSize * currentScale + this.fontSizeType
                });
            this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
        },
        finish: function (position) {
            if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
        },
        setDimensions: function (height, width) {
            var d = {};
            if (this.options.scaleX) d.width = width.round() + 'px';
            if (this.options.scaleY) d.height = height.round() + 'px';
            if (this.options.scaleFromCenter) {
                var topd = (height - this.dims[0]) / 2;
                var leftd = (width - this.dims[1]) / 2;
                if (this.elementPositioning == 'absolute') {
                    if (this.options.scaleY) d.top = this.originalTop - topd + 'px';
                    if (this.options.scaleX) d.left = this.originalLeft - leftd + 'px';
                } else {
                    if (this.options.scaleY) d.top = -topd + 'px';
                    if (this.options.scaleX) d.left = -leftd + 'px';
                }
            }
            this.element.setStyle(d);
        }
    });
    Effect.Highlight = Class.create(Effect.Base, {
        initialize: function (element) {
            this.element = $(element);
            if (!this.element) throw (Effect._elementDoesNotExistError);
            var options = Object.extend({
                startcolor: '#ffff99'
            }, arguments[1] || {});
            this.start(options);
        },
        setup: function () {
            if (this.element.getStyle('display') == 'none') {
                this.cancel();
                return;
            }
            this.oldStyle = {};
            if (!this.options.keepBackgroundImage) {
                this.oldStyle.backgroundImage = this.element.getStyle('background-image');
                this.element.setStyle({
                    backgroundImage: 'none'
                });
            }
            if (!this.options.endcolor)
                this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
            if (!this.options.restorecolor)
                this.options.restorecolor = this.element.getStyle('background-color')
            this._base = $R(0, 2).map(function (i) {
                return parseInt(this.options.startcolor.slice(i * 2 + 1, i * 2 + 3), 16)
            }.bind(this));
            this._delta = $R(0, 2).map(function (i) {
                return parseInt(this.options.endcolor.slice(i * 2 + 1, i * 2 + 3), 16) - this._base[i]
            }.bind(this));
        },
        update: function (position) {
            this.element.setStyle({
                backgroundColor: $R(0, 2).inject('#', function (m, v, i) {
                    return m + ((this._base[i] + (this._delta[i] * position)).round().toColorPart());
                }.bind(this))
            });
        },
        finish: function () {
            this.element.setStyle(Object.extend(this.oldStyle, {
                backgroundColor: this.options.restorecolor
            }));
        }
    });
    Effect.ScrollTo = function (element) {
        var options = arguments[1] || {},
            scrollOffsets = document.viewport.getScrollOffsets(),
            elementOffsets = $(element).cumulativeOffset();
        if (options.offset) elementOffsets[1] += options.offset;
        return new Effect.Tween(null,
        scrollOffsets.top,
        elementOffsets[1],
        options,

        function (p) {
            scrollTo(scrollOffsets.left, p.round());
        });
    };
    Effect.Fade = function (element) {
        element = $(element);
        var oldOpacity = element.getInlineOpacity();
        var options = Object.extend({
            from: element.getOpacity() || 1.0,
            to: 0.0,
            afterFinishInternal: function (effect) {
                if (effect.options.to != 0) return;
                effect.element.hide().setStyle({
                    opacity: oldOpacity
                });
            }
        }, arguments[1] || {});
        return new Effect.Opacity(element, options);
    };
    Effect.Appear = function (element) {
        element = $(element);
        var options = Object.extend({
            from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
            to: 1.0,
            afterFinishInternal: function (effect) {
                effect.element.forceRerendering();
            },
            beforeSetup: function (effect) {
                effect.element.setOpacity(effect.options.from).show();
            }
        }, arguments[1] || {});
        return new Effect.Opacity(element, options);
    };
    Effect.Puff = function (element) {
        element = $(element);
        var oldStyle = {
            opacity: element.getInlineOpacity(),
            position: element.getStyle('position'),
            top: element.style.top,
            left: element.style.left,
            width: element.style.width,
            height: element.style.height
        };
        return new Effect.Parallel(
        [new Effect.Scale(element, 200, {
                sync: true,
                scaleFromCenter: true,
                scaleContent: true,
                restoreAfterFinish: true
            }),
            new Effect.Opacity(element, {
                sync: true,
                to: 0.0
            })
        ],
        Object.extend({
            duration: 1.0,
            beforeSetupInternal: function (effect) {
                Position.absolutize(effect.effects[0].element);
            },
            afterFinishInternal: function (effect) {
                effect.effects[0].element.hide().setStyle(oldStyle);
            }
        }, arguments[1] || {}));
    };
    Effect.BlindUp = function (element) {
        element = $(element);
        element.makeClipping();
        return new Effect.Scale(element, 0,
        Object.extend({
            scaleContent: false,
            scaleX: false,
            restoreAfterFinish: true,
            afterFinishInternal: function (effect) {
                effect.element.hide().undoClipping();
            }
        }, arguments[1] || {}));
    };
    Effect.BlindDown = function (element) {
        element = $(element);
        var elementDimensions = element.getDimensions();
        return new Effect.Scale(element, 100, Object.extend({
            scaleContent: false,
            scaleX: false,
            scaleFrom: 0,
            scaleMode: {
                originalHeight: elementDimensions.height,
                originalWidth: elementDimensions.width
            },
            restoreAfterFinish: true,
            afterSetup: function (effect) {
                effect.element.makeClipping().setStyle({
                    height: '0px'
                }).show();
            },
            afterFinishInternal: function (effect) {
                effect.element.undoClipping();
            }
        }, arguments[1] || {}));
    };
    Effect.SwitchOff = function (element) {
        element = $(element);
        var oldOpacity = element.getInlineOpacity();
        return new Effect.Appear(element, Object.extend({
            duration: 0.4,
            from: 0,
            transition: Effect.Transitions.flicker,
            afterFinishInternal: function (effect) {
                new Effect.Scale(effect.element, 1, {
                    duration: 0.3,
                    scaleFromCenter: true,
                    scaleX: false,
                    scaleContent: false,
                    restoreAfterFinish: true,
                    beforeSetup: function (effect) {
                        effect.element.makePositioned().makeClipping();
                    },
                    afterFinishInternal: function (effect) {
                        effect.element.hide().undoClipping().undoPositioned().setStyle({
                            opacity: oldOpacity
                        });
                    }
                });
            }
        }, arguments[1] || {}));
    };
    Effect.DropOut = function (element) {
        element = $(element);
        var oldStyle = {
            top: element.getStyle('top'),
            left: element.getStyle('left'),
            opacity: element.getInlineOpacity()
        };
        return new Effect.Parallel(
        [new Effect.Move(element, {
                x: 0,
                y: 100,
                sync: true
            }),
            new Effect.Opacity(element, {
                sync: true,
                to: 0.0
            })
        ],
        Object.extend({
            duration: 0.5,
            beforeSetup: function (effect) {
                effect.effects[0].element.makePositioned();
            },
            afterFinishInternal: function (effect) {
                effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
            }
        }, arguments[1] || {}));
    };
    Effect.Shake = function (element) {
        element = $(element);
        var options = Object.extend({
            distance: 20,
            duration: 0.5
        }, arguments[1] || {});
        var distance = parseFloat(options.distance);
        var split = parseFloat(options.duration) / 10.0;
        var oldStyle = {
            top: element.getStyle('top'),
            left: element.getStyle('left')
        };
        return new Effect.Move(element, {
            x: distance,
            y: 0,
            duration: split,
            afterFinishInternal: function (effect) {
                new Effect.Move(effect.element, {
                    x: -distance * 2,
                    y: 0,
                    duration: split * 2,
                    afterFinishInternal: function (effect) {
                        new Effect.Move(effect.element, {
                            x: distance * 2,
                            y: 0,
                            duration: split * 2,
                            afterFinishInternal: function (effect) {
                                new Effect.Move(effect.element, {
                                    x: -distance * 2,
                                    y: 0,
                                    duration: split * 2,
                                    afterFinishInternal: function (effect) {
                                        new Effect.Move(effect.element, {
                                            x: distance * 2,
                                            y: 0,
                                            duration: split * 2,
                                            afterFinishInternal: function (effect) {
                                                new Effect.Move(effect.element, {
                                                    x: -distance,
                                                    y: 0,
                                                    duration: split,
                                                    afterFinishInternal: function (effect) {
                                                        effect.element.undoPositioned().setStyle(oldStyle);
                                                    }
                                                });
                                            }
                                        });
                                    }
                                });
                            }
                        });
                    }
                });
            }
        });
    };
    Effect.SlideDown = function (element) {
        element = $(element).cleanWhitespace()
        var oldInnerBottom = element.down().getStyle('bottom');
        var elementDimensions = element.getDimensions();
        return new Effect.Scale(element, 100, Object.extend({
            scaleContent: false,
            scaleX: false,
            scaleFrom: window.opera ? 0 : 1,
            scaleMode: {
                originalHeight: elementDimensions.height,
                originalWidth: elementDimensions.width
            },
            restoreAfterFinish: true,
            afterSetup: function (effect) {
                effect.element.makePositioned();
                effect.element.down().makePositioned();
                if (window.opera) effect.element.setStyle({
                        top: ''
                    });
                effect.element.makeClipping().setStyle({
                    height: '0px'
                }).show();
            },
            afterUpdateInternal: function (effect) {
                effect.element.down().setStyle({
                    bottom:
                        (effect.dims[0] - effect.element.clientHeight) + 'px'
                });
            },
            afterFinishInternal: function (effect) {
                effect.element.undoClipping().undoPositioned();
                effect.element.down().undoPositioned().setStyle({
                    bottom: oldInnerBottom
                });
            }
        }, arguments[1] || {}));
    };
    Effect.SlideUp = function (element) {
        element = $(element).cleanWhitespace();
        var oldInnerBottom = element.down().getStyle('bottom');
        var elementDimensions = element.getDimensions();
        return new Effect.Scale(element, window.opera ? 0 : 1,
        Object.extend({
            scaleContent: false,
            scaleX: false,
            scaleMode: 'box',
            scaleFrom: 100,
            scaleMode: {
                originalHeight: elementDimensions.height,
                originalWidth: elementDimensions.width
            },
            restoreAfterFinish: true,
            afterSetup: function (effect) {
                effect.element.makePositioned();
                effect.element.down().makePositioned();
                if (window.opera) effect.element.setStyle({
                        top: ''
                    });
                effect.element.makeClipping().show();
            },
            afterUpdateInternal: function (effect) {
                effect.element.down().setStyle({
                    bottom:
                        (effect.dims[0] - effect.element.clientHeight) + 'px'
                });
            },
            afterFinishInternal: function (effect) {
                effect.element.hide().undoClipping().undoPositioned();
                effect.element.down().undoPositioned().setStyle({
                    bottom: oldInnerBottom
                });
            }
        }, arguments[1] || {}));
    }
    Effect.Squish = function (element) {
        return new Effect.Scale(element, window.opera ? 1 : 0, {
            restoreAfterFinish: true,
            beforeSetup: function (effect) {
                effect.element.makeClipping();
            },
            afterFinishInternal: function (effect) {
                effect.element.hide().undoClipping();
            }
        });
    };
    Effect.Grow = function (element) {
        element = $(element);
        var options = Object.extend({
            direction: 'center',
            moveTransition: Effect.Transitions.sinoidal,
            scaleTransition: Effect.Transitions.sinoidal,
            opacityTransition: Effect.Transitions.full
        }, arguments[1] || {});
        var oldStyle = {
            top: element.style.top,
            left: element.style.left,
            height: element.style.height,
            width: element.style.width,
            opacity: element.getInlineOpacity()
        };
        var dims = element.getDimensions();
        var initialMoveX, initialMoveY;
        var moveX, moveY;
        switch (options.direction) {
            case 'top-left':
                initialMoveX = initialMoveY = moveX = moveY = 0;
                break;
            case 'top-right':
                initialMoveX = dims.width;
                initialMoveY = moveY = 0;
                moveX = -dims.width;
                break;
            case 'bottom-left':
                initialMoveX = moveX = 0;
                initialMoveY = dims.height;
                moveY = -dims.height;
                break;
            case 'bottom-right':
                initialMoveX = dims.width;
                initialMoveY = dims.height;
                moveX = -dims.width;
                moveY = -dims.height;
                break;
            case 'center':
                initialMoveX = dims.width / 2;
                initialMoveY = dims.height / 2;
                moveX = -dims.width / 2;
                moveY = -dims.height / 2;
                break;
        }
        return new Effect.Move(element, {
            x: initialMoveX,
            y: initialMoveY,
            duration: 0.01,
            beforeSetup: function (effect) {
                effect.element.hide().makeClipping().makePositioned();
            },
            afterFinishInternal: function (effect) {
                new Effect.Parallel(
                [new Effect.Opacity(effect.element, {
                        sync: true,
                        to: 1.0,
                        from: 0.0,
                        transition: options.opacityTransition
                    }),
                    new Effect.Move(effect.element, {
                        x: moveX,
                        y: moveY,
                        sync: true,
                        transition: options.moveTransition
                    }),
                    new Effect.Scale(effect.element, 100, {
                        scaleMode: {
                            originalHeight: dims.height,
                            originalWidth: dims.width
                        },
                        sync: true,
                        scaleFrom: window.opera ? 1 : 0,
                        transition: options.scaleTransition,
                        restoreAfterFinish: true
                    })
                ], Object.extend({
                    beforeSetup: function (effect) {
                        effect.effects[0].element.setStyle({
                            height: '0px'
                        }).show();
                    },
                    afterFinishInternal: function (effect) {
                        effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
                    }
                }, options));
            }
        });
    };
    Effect.Shrink = function (element) {
        element = $(element);
        var options = Object.extend({
            direction: 'center',
            moveTransition: Effect.Transitions.sinoidal,
            scaleTransition: Effect.Transitions.sinoidal,
            opacityTransition: Effect.Transitions.none
        }, arguments[1] || {});
        var oldStyle = {
            top: element.style.top,
            left: element.style.left,
            height: element.style.height,
            width: element.style.width,
            opacity: element.getInlineOpacity()
        };
        var dims = element.getDimensions();
        var moveX, moveY;
        switch (options.direction) {
            case 'top-left':
                moveX = moveY = 0;
                break;
            case 'top-right':
                moveX = dims.width;
                moveY = 0;
                break;
            case 'bottom-left':
                moveX = 0;
                moveY = dims.height;
                break;
            case 'bottom-right':
                moveX = dims.width;
                moveY = dims.height;
                break;
            case 'center':
                moveX = dims.width / 2;
                moveY = dims.height / 2;
                break;
        }
        return new Effect.Parallel(
        [new Effect.Opacity(element, {
                sync: true,
                to: 0.0,
                from: 1.0,
                transition: options.opacityTransition
            }),
            new Effect.Scale(element, window.opera ? 1 : 0, {
                sync: true,
                transition: options.scaleTransition,
                restoreAfterFinish: true
            }),
            new Effect.Move(element, {
                x: moveX,
                y: moveY,
                sync: true,
                transition: options.moveTransition
            })
        ], Object.extend({
            beforeStartInternal: function (effect) {
                effect.effects[0].element.makePositioned().makeClipping();
            },
            afterFinishInternal: function (effect) {
                effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle);
            }
        }, options));
    };
    Effect.Pulsate = function (element) {
        element = $(element);
        var options = arguments[1] || {},
            oldOpacity = element.getInlineOpacity(),
            transition = options.transition || Effect.Transitions.linear,
            reverser = function (pos) {
                return 1 - transition((-Math.cos((pos * (options.pulses || 5) * 2) * Math.PI) / 2) + .5);
            };
        return new Effect.Opacity(element,
        Object.extend(Object.extend({
            duration: 2.0,
            from: 0,
            afterFinishInternal: function (effect) {
                effect.element.setStyle({
                    opacity: oldOpacity
                });
            }
        }, options), {
            transition: reverser
        }));
    };
    Effect.Fold = function (element) {
        element = $(element);
        var oldStyle = {
            top: element.style.top,
            left: element.style.left,
            width: element.style.width,
            height: element.style.height
        };
        element.makeClipping();
        return new Effect.Scale(element, 5, Object.extend({
            scaleContent: false,
            scaleX: false,
            afterFinishInternal: function (effect) {
                new Effect.Scale(element, 1, {
                    scaleContent: false,
                    scaleY: false,
                    afterFinishInternal: function (effect) {
                        effect.element.hide().undoClipping().setStyle(oldStyle);
                    }
                });
            }
        }, arguments[1] || {}));
    };
    Effect.Morph = Class.create(Effect.Base, {
        initialize: function (element) {
            this.element = $(element);
            if (!this.element) throw (Effect._elementDoesNotExistError);
            var options = Object.extend({
                style: {}
            }, arguments[1] || {});
            if (!Object.isString(options.style)) this.style = $H(options.style);
            else {
                if (options.style.include(':'))
                    this.style = options.style.parseStyle();
                else {
                    this.element.addClassName(options.style);
                    this.style = $H(this.element.getStyles());
                    this.element.removeClassName(options.style);
                    var css = this.element.getStyles();
                    this.style = this.style.reject(function (style) {
                        return style.value == css[style.key];
                    });
                    options.afterFinishInternal = function (effect) {
                        effect.element.addClassName(effect.options.style);
                        effect.transforms.each(function (transform) {
                            effect.element.style[transform.style] = '';
                        });
                    };
                }
            }
            this.start(options);
        },
        setup: function () {
            function parseColor(color) {
                if (!color || ['rgba(0, 0, 0, 0)', 'transparent'].include(color)) color = '#ffffff';
                color = color.parseColor();
                return $R(0, 2).map(function (i) {
                    return parseInt(color.slice(i * 2 + 1, i * 2 + 3), 16);
                });
            }
            this.transforms = this.style.map(function (pair) {
                var property = pair[0],
                    value = pair[1],
                    unit = null;
                if (value.parseColor('#zzzzzz') != '#zzzzzz') {
                    value = value.parseColor();
                    unit = 'color';
                } else if (property == 'opacity') {
                    value = parseFloat(value);
                    if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
                        this.element.setStyle({
                            zoom: 1
                        });
                } else if (Element.CSS_LENGTH.test(value)) {
                    var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
                    value = parseFloat(components[1]);
                    unit = (components.length == 3) ? components[2] : null;
                }
                var originalValue = this.element.getStyle(property);
                return {
                    style: property.camelize(),
                    originalValue: unit == 'color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
                    targetValue: unit == 'color' ? parseColor(value) : value,
                    unit: unit
                };
            }.bind(this)).reject(function (transform) {
                return (
                (transform.originalValue == transform.targetValue) ||
                    (
                transform.unit != 'color' &&
                    (isNaN(transform.originalValue) || isNaN(transform.targetValue))));
            });
        },
        update: function (position) {
            var style = {}, transform, i = this.transforms.length;
            while (i--)
                style[(transform = this.transforms[i]).style] =
                    transform.unit == 'color' ? '#' +
                    (Math.round(transform.originalValue[0] +
                    (transform.targetValue[0] - transform.originalValue[0]) * position)).toColorPart() +
                    (Math.round(transform.originalValue[1] +
                    (transform.targetValue[1] - transform.originalValue[1]) * position)).toColorPart() +
                    (Math.round(transform.originalValue[2] +
                    (transform.targetValue[2] - transform.originalValue[2]) * position)).toColorPart() :
                    (transform.originalValue +
                    (transform.targetValue - transform.originalValue) * position).toFixed(3) +
                    (transform.unit === null ? '' : transform.unit);
            this.element.setStyle(style, true);
        }
    });
    Effect.Transform = Class.create({
        initialize: function (tracks) {
            this.tracks = [];
            this.options = arguments[1] || {};
            this.addTracks(tracks);
        },
        addTracks: function (tracks) {
            tracks.each(function (track) {
                track = $H(track);
                var data = track.values().first();
                this.tracks.push($H({
                    ids: track.keys().first(),
                    effect: Effect.Morph,
                    options: {
                        style: data
                    }
                }));
            }.bind(this));
            return this;
        },
        play: function () {
            return new Effect.Parallel(
            this.tracks.map(function (track) {
                var ids = track.get('ids'),
                    effect = track.get('effect'),
                    options = track.get('options');
                var elements = [$(ids) || $$(ids)].flatten();
                return elements.map(function (e) {
                    return new effect(e, Object.extend({
                        sync: true
                    }, options))
                });
            }).flatten(),
            this.options);
        }
    });
    Element.CSS_PROPERTIES = $w(
        'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
        'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
        'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
        'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
        'fontSize fontWeight height left letterSpacing lineHeight ' +
        'marginBottom marginLeft marginRight marginTop markerOffset maxHeight ' +
        'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
        'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
        'right textIndent top width wordSpacing zIndex');
    Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
    String.__parseStyleElement = document.createElement('div');
    String.prototype.parseStyle = function () {
        var style, styleRules = $H();
        if (Prototype.Browser.WebKit)
            style = new Element('div', {
                style: this
            }).style;
        else {
            String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>';
            style = String.__parseStyleElement.childNodes[0].style;
        }
        Element.CSS_PROPERTIES.each(function (property) {
            if (style[property]) styleRules.set(property, style[property]);
        });
        if (Prototype.Browser.IE && this.include('opacity'))
            styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);
        return styleRules;
    };
    if (document.defaultView && document.defaultView.getComputedStyle) {
        Element.getStyles = function (element) {
            var css = document.defaultView.getComputedStyle($(element), null);
            return Element.CSS_PROPERTIES.inject({}, function (styles, property) {
                styles[property] = css[property];
                return styles;
            });
        };
    } else {
        Element.getStyles = function (element) {
            element = $(element);
            var css = element.currentStyle,
                styles;
            styles = Element.CSS_PROPERTIES.inject({}, function (results, property) {
                results[property] = css[property];
                return results;
            });
            if (!styles.opacity) styles.opacity = element.getOpacity();
            return styles;
        };
    }
    Effect.Methods = {
        morph: function (element, style) {
            element = $(element);
            new Effect.Morph(element, Object.extend({
                style: style
            }, arguments[2] || {}));
            return element;
        },
        visualEffect: function (element, effect, options) {
            element = $(element);
            var s = effect.dasherize().camelize(),
                klass = s.charAt(0).toUpperCase() + s.substring(1);
            new Effect[klass](element, options);
            return element;
        },
        highlight: function (element, options) {
            element = $(element);
            new Effect.Highlight(element, options);
            return element;
        }
    };
    $w('fade appear grow shrink fold blindUp blindDown slideUp slideDown ' +
        'pulsate shake puff squish switchOff dropOut').each(

    function (effect) {
        Effect.Methods[effect] = function (element, options) {
            element = $(element);
            Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
            return element;
        };
    });
    $w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(

    function (f) {
        Effect.Methods[f] = Element[f];
    });
    Element.addMethods(Effect.Methods);
}
if (typeof NYTMM == 'undefined') {
    var NYTMM = {}
    NYTMM.Skins = {
        DEFAULT: "default",
        DARK: "dark",
        LIGHT: "light"
    };
    NYTMM.Browsers = {
        OPERA: "opera",
        FIREFOX: "firefox",
        IE: "ie",
        CHROME: "chrome",
        SAFARI: "safari"
    };
    NYTMM.Platforms = {
        IPHONE: "iphone",
        IPAD: "ipad",
        OTHER: "other"
    };
    NYTMM.Align = {
        TOP: "top",
        BOTTOM: "bottom",
        CENTER: "center",
        RIGHT: "right",
        LEFT: "left"
    };
    NYTMM.DebugLevel = 1
    NYTMM.Urls = {
        URL_SHORTNER: "http://nytmm-tools.appspot.com/shorten?long_url=" // pass along with a long_url param -- this is a URL shorterner addresss
    };
    NYTMM.browserVersion = "";
    NYTMM.browser = "";
    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
        NYTMM.browser = NYTMM.Browsers.IE;
        NYTMM.browserVersion = new Number(RegExp.$1);
    } else if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
        NYTMM.browser = NYTMM.Browsers.FIREFOX;
        NYTMM.browserVersion = new Number(RegExp.$1);
    } else if (/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
        NYTMM.browser = NYTMM.Browsers.OPERA;
        NYTMM.browserVersion = new Number(RegExp.$1);
    } else if (/(\d+\.\d+)\.?\d*?[\/\s]Safari/.test(navigator.userAgent)) {
        NYTMM.browser = NYTMM.Browsers.SAFARI;
        NYTMM.browserVersion = new Number(RegExp.$1);
    }
    NYTMM.platform = NYTMM.Platforms.OTHER;
    if (navigator.userAgent.match(/iPad/i) != null) NYTMM.platform = NYTMM.Platforms.IPAD;
    else if (navigator.userAgent.match(/iPhone/i) != null) NYTMM.platform = NYTMM.Platforms.IPHONE;
    NYTMM.log = function (s) {
        if (NYTMM.DebugLevel == 1) {
            if (window.console && console.log) console.log(s);
        } else if (NYTMM.DebugLevel == 2) {
            alert(s);
        }
    }
    NYTMM.createElement = function (tag, value, cName, attrs, styles) {
        if (attrs == null) attrs = new Object();
        if (styles == null) styles = new Object();
        var e = document.createElement(tag);
        if (cName != null && cName != "") e.className = cName;
        if (value != null && value != "" && tag != "img") e.innerHTML = value
        for (a in attrs) {
            e.setAttribute(a, attrs[a]);
        }
        for (s in styles) {
            e.style[s] = styles[s];
        }
        try {
            Element.extend(e);
        } catch (e) {}
        return e;
    };
    NYTMM.removeChildrenOf = function (e) {
        e.innerHTML = '';
        return e;
    };
    NYTMM.replaceChildrenOf = function (p, c) {
        NYTMM.removeChildrenOf(p);
        if (typeof (c) == "string") {
            p.innerHTML = c;
        } else if (c.length) {
            for (var i = 0; i < c.length; i++) {
                p.appendChild(c[i]);
            }
        } else p.appendChild(c);
        return p;
    };
    NYTMM.getFlashVersion = function () {
        if (typeof NYTMM.flashVersion != "undefined") return NYTMM.flashVersion;
        var version = 0;
        if (typeof navigator.plugins != "undefined" && typeof navigator.plugins["Shockwave Flash"] == "object") {
            desc = navigator.plugins["Shockwave Flash"].description;
            if (desc && !(typeof navigator.mimeTypes != "undefined" && navigator.mimeTypes["application/x-shockwave-flash"] && !navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)) {
                version = parseInt(desc.match(/^.*\s+([^\s]+)\.[^\s]+\s+[^\s]+$/)[1]);
            }
        } else if (typeof window.ActiveXObject != "undefined") {
            try {
                var testObject = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
                if (testObject) version = parseInt(testObject.GetVariable("$version").match(/^[^\s]+\s(\d+)/)[1]);
            } catch (e) {}
        }
        return NYTMM.flashVersion = version;
    };
    NYTMM.Includes = {
        js: [],
        css: [],
        includeJS: function (src, once) {
            if (once == null) once = true;
            if (once) {
                for (var i = 0; i < NYTMM.Includes.js.length; i++) {
                    if (NYTMM.Includes.js[i] == src) return false;
                }
            }
            NYTMM.Includes.js.push(src);
            document.write("<script language=\"javascript\" type=\"text/javascript\" src=\"" + src + "\" ></script>");
        },
        includeCSS: function (src, once) {
            if (once == null) once = true;
            if (once) {
                for (var i = 0; i < NYTMM.Includes.css.length; i++) {
                    if (NYTMM.Includes.css[i] == src) return false;
                }
            }
            NYTMM.Includes.css.push(src);
            document.write("<link href=\"" + src + "\" type=\"text/css\" rel=\"stylesheet\" />");
        }
    };
}
if (typeof NYTMM != 'undefined' && typeof NYTMM.Math2 == 'undefined') {
    NYTMM.Math2 = ({
        init: function () {
            return this;
        },
        floatPrecision: function (number, precision) {
            var precision = (precision != null) ? precision : 5;
            var correction = Math.pow(10, precision);
            return Math.round(correction * number) / correction;
        }
    }).init();
}
if (typeof NYTMM != 'undefined' && typeof NYTMM.Strings == 'undefined') {
    NYTMM.Strings = ({
        init: function () {
            return this;
        },
        toCamelCase: function (s, forceLowerCase) {
            if (forceLowerCase !== false) forceLowerCase = true;
            var sps = ((forceLowerCase) ? s.toLowerCase() : s).split(" ");
            for (var i = 0; i < sps.length; i++) {
                sps[i] = sps[i].substr(0, 1).toUpperCase() + sps[i].substr(1);
            }
            return sps.join(" ");
        },
        linkify: function (text, targets) {
            if (!text) return text;
            text = text.replace(/((https?\:\/\/|ftp\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi, function (url) {
                var nice = url;
                if (url.search('^https?:\/\/') < 0) url = 'http://' + url;
                if (targets == null || targets == "") return '<a href="' + url + '">' + url + '</a>';
                else return '<a href="' + url + '" target="' + targets + '">' + url + '</a>';
            });
            return text;
        },
        nl2br: function (text) {
            return text.replace(/(\r\n|[\r\n]|\\n|\\r)/g, "<br/>");
        },
        toHTML: function (text) {
            text = this.nl2br(text);
            text = this.linkify(text);
            return text.replace(/\s\s/g, "&nbsp;&nbsp;");
        },
        toId: function (s) {
            return s.toLowerCase().replace(/\s/g, "_").replace(/[^\w]/g, "");
        },
        number2money: function (n, symbol, padding) {
            var symbol = (symbol != null) ? symbol : true
            var padding = (padding != null) ? padding : false
            var number = NYTMM.Math2.floatPrecision(n, 2)
            var formatted = this.niceNumber(number)
            if (!formatted.split(/\./g)[1] && padding) formatted = formatted + ".00"
            if (symbol) formatted = "$" + formatted;
            return formatted;
        },
        niceNumber: function (n) {
            var amount = String(Math.abs(Number(n)));
            var leftOfDecimal = amount.split(/\./g)[0];
            var rightOfDecimal = amount.split(/\./g)[1];
            var formatted_text = '';
            var num_a = leftOfDecimal.toArray();
            num_a.reverse();
            for (var i = 1; i <= num_a.length; i++) {
                if ((i % 3 == 0) && (i < num_a.length)) {
                    formatted_text = "," + num_a[i - 1] + formatted_text;
                } else {
                    formatted_text = num_a[i - 1] + formatted_text;
                }
            }
            if (rightOfDecimal != null && rightOfDecimal != '' && rightOfDecimal != undefined) {
                return formatted_text + "." + rightOfDecimal;
            } else {
                return formatted_text;
            }
        },
        wordCount: function (s) {
            var fullStr = s + " ";
            var initial_whitespace_rExp = /^[^A-Za-z0-9\'\-]+/gi;
            var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
            var non_alphanumerics_rExp = /[^A-Za-z0-9\'\-]+/gi;
            var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
            var splitString = cleanedStr.split(" ");
            var word_count = splitString.length - 1;
            if (fullStr.length < 2) {
                word_count = 0;
            }
            return word_count;
        },
        truncateWords: function (s, min, max) {
            if (!min) min = 30;
            if (!max) max = min;
            var initial_whitespace_rExp = /^[^A-Za-z0-9\'\-]+/gi;
            var left_trimmedStr = s.replace(initial_whitespace_rExp, "");
            var words = left_trimmedStr.split(" ");
            var result = [];
            min = Math.min(words.length, min);
            max = Math.min(words.length, max);
            for (var i = 0; i < min; i++) {
                result.push(words[i]);
            }
            for (var j = min; i < max; i++) {
                var word = words[i];
                result.push(word);
                if (word.charAt(word.length - 1) == '.') {
                    break;
                }
            }
            return (result.join(' '));
        },
        parseURLParams: function (url) {
            var query = (url == null) ? window.location.search.substring(1) : url.replace(/^.*\?/, '');
            var params = {};
            var pairs = query.split("&");
            for (var i = 0; i < pairs.length; i++) {
                var pair = pairs[i].split('=');
                if (pair.length > 1) {
                    var argname = decodeURI(pair[0]);
                    var value = decodeURI(pair[1]);
                    params[argname] = value;
                }
            }
            return params;
        }
    }).init();
}
if (typeof NYTMM != 'undefined' && typeof NYTMM.Utils == 'undefined') {
    NYTMM.Utils = ({
        init: function () {
            return this;
        },
        shuffleArray: function (a) {
            var ns = a.length * 2;
            for (var i = 0; i < ns; i++) {
                var p1 = Math.floor(Math.random() * a.length);
                var p2 = Math.floor(Math.random() * a.length);
                var tmp = a[p1];
                a[p1] = a[p2];
                a[p2] = tmp;
            }
            return a;
        },
        isArray: function (value) {
            return value &&
                typeof value === 'object' &&
                typeof value.length === 'number' &&
                typeof value.splice === 'function' && !(value.propertyIsEnumerable('length'));
        },
        percentToColor: function (percent) {
            percent = 1 - percent;
            var channel = Math.round(0xff * percent);
            var color = channel * 0x10000 + channel * 0x100 + channel;
            var colorStr = color.toString(16);
            while (colorStr.length < 6) {
                colorStr = '0' + colorStr;
            }
            colorStr = '#' + colorStr;
            return colorStr;
        }
    }).init();
}
if (typeof NYTMM != 'undefined' && typeof NYTMM.LocationHash == 'undefined') {
    NYTMM.LocationHash = ({
        init: function () {
            this.currentHash = this.getHash()
            this.checkInterval = setInterval(this.checkHash.bind(this), 200);
            return this;
        },
        checkInitialHash: function () {
            this.currentHash = this.getHash();
            document.fire(NYTMM.LocationHash.CHANGE_EVENT, {
                target: this
            });
        },
        checkHash: function () {
            var h = this.getHash();
            if (h != this.currentHash) {
                this.currentHash = h;
                document.fire(NYTMM.LocationHash.CHANGE_EVENT, {
                    target: this
                });
            }
        },
        getHash: function () {
            var h = window.location.hash || "";
            return h.replace(/^#/g, "");
        },
        setHash: function (h, dispatch) {
            window.location.hash = h;
            if (dispatch || dispatch === null) this.checkHash();
            else this.currentHash = h;
        },
        getHashParts: function (splitOn) {
            if (!splitOn) splitOn = "/";
            return this.getHash().split(splitOn);
        }
    }).init();
    NYTMM.LocationHash.CHANGE_EVENT = "NYTMM.LocationHash:change";
}
if (typeof NYTMM != 'undefined' && typeof NYTMM.ButtonFactory == 'undefined') {
    NYTMM.ButtonFactory = ({
        initialize: function () {
            return this;
        },
        notchedButton: function (lbl, color, vPadding, hPadding) {
            if (vPadding == null) vPadding = 5;
            if (hPadding == null) hPadding = vPadding;
            if (lbl.match(/\.(png|gif|jpg)$/i)) lbl = "<img src=\"" + lbl + "\" />";
            var btn = NYTMM.createElement("div", "", "nytmm_notchedButton");
            btn.appendChild(NYTMM.createElement("div", "", "left", null, {
                backgroundColor: color
            }));
            btn.appendChild(NYTMM.createElement("div", lbl, "center", null, {
                padding: vPadding + "px " + hPadding + "px",
                backgroundColor: color
            }));
            btn.appendChild(NYTMM.createElement("div", "", "right", null, {
                backgroundColor: color
            }));
            return btn;
        },
        radioButton: function (lbl, value) {
            if (value == null) value = lbl;
            var btn = NYTMM.createElement("div", "", "nytmm_radioButton");
            btn.appendChild(NYTMM.createElement("input", "", "", {
                value: value,
                type: 'radio'
            }));
            btn.appendChild(NYTMM.createElement("span", lbl));
            return btn;
        },
        checkboxButton: function (lbl, value) {
            if (value == null) value = lbl;
            var btn = NYTMM.createElement("div", "", "nytmm_checkboxButton");
            btn.appendChild(NYTMM.createElement("input", "", "", {
                value: value,
                type: 'checkbox'
            }));
            btn.appendChild(NYTMM.createElement("span", lbl));
            return btn;
        },
        checklistButton: function (lbl) {
            var btn = NYTMM.createElement("div", "", "nytmm_checklistButton");
            btn.appendChild(NYTMM.createElement("img", "", "", {
                src: 'http://graphics8.nytimes.com/packages/images/multimedia/TEMPLATES/CheckBoxes/checkbox.png'
            }));
            btn.appendChild(NYTMM.createElement("span", lbl));
            return btn;
        },
        graphicCheckboxButton: function (lbl, color) {
            var color = (color != null) ? color : 'mmblue';
            var colorClass = 'nytmm_graphicCheckboxButton_img_' + color;
            var btn = NYTMM.createElement("div", "", "nytmm_graphicCheckboxButton");
            btn.appendChild(NYTMM.createElement("div", "", "nytmm_graphicCheckboxButton_img " + colorClass));
            btn.appendChild(NYTMM.createElement("span", lbl));
            return btn;
        }
    }).initialize();
}
if (window.location.href.match(/^(http:\/\/)?swww.nytimes.com/i)) {
    var qps = window.location.href.toQueryParams();
    if (qps.dataURL) NYTD.require(qps.dataURL);
    else NYTD.require("http://mmstorage.nyhq.nytint.com/tools/oneOffsChameleon/temp/tmp1301603570.js");
}
NYTMM.ComingOut = {
    STATES: {
        MENU: "menu",
        STORY: "story"
    },
    STORY_TYPES: {
        NYT: "nyt",
        USER: "user"
    },
    imageBase: "http://graphics8.nytimes.com/packages/images/us/2011-coming-out/",
    videoBase: "http://graphics8.nytimes.com/packages/video/us/2011-coming-out/",
    stuffyFormURL: "http://submit.nytimes.com/coming-out",
    userSubmissionDataURL: "http://www.nytimes.com/svc/int/stuffy/api/projects/coming-out/submissions.json"
};
NYTMM.ComingOut.StoryMenu = Class.create({
    initialize: function (stories) {
        this.stories = stories;
        this.userStories = []
        this.menuItems = [];
        this.userItems = [];
        this.offsetTop = 0;
        this.windowHeight = 0;
        this.focusedIndex = -1;
        this.active = false;
        this.pendingUserListBuild = false;
        this.windowScrollCallback = this.onWindowScroll.bind(this);
        this.windowSizeCallback = this.onWindowResize.bind(this)
        this.layout = NYTMM.createElement("div", "", "nytmm_comingOut_storyMenu")
        this.introItem = new NYTMM.ComingOut.IntroMenuItem();
        this.menuItems.push(this.introItem);
        this.layout.appendChild(this.introItem.layout)
        var yPos = this.introItem.itemHeight;
        for (var i = 0; i < this.stories.length; i++) {
            var s = this.stories[i];
            var si = new NYTMM.ComingOut.StoryMenuItem(s)
            this.menuItems.push(si);
            this.layout.appendChild(si.layout)
        }
        this.layout.insert(NYTMM.createElement('p', 'Produced by Meaghan Looram, Jon Huang, Tom Jackson, Andrew Kueneman, Samantha Stark, Jacqui Maher, and David Nolen | Additional Reporting by Lori Moore', 'mmcredit2'))
        this.usersSection = this.layout.appendChild(NYTMM.createElement("div", "", "userStoriesSection clearfix"));
        var nameplate = this.usersSection.appendChild(NYTMM.createElement("div", "<h2><span class='userCount'></span> Reader-Submitted Stories</h2>", "nameplate"));
        nameplate.insert(NYTMM.createElement("p", NYTMM.ComingOut.app.data.userintro))
        //		toSubmitButton.observe('click', function(e){ window.open(NYTMM.ComingOut.stuffyFormURL,"submissionForm"); });
        var user1 = this.usersSection.appendChild(NYTMM.createElement("ul", "", "userStories clearfix"));
        var user2 = this.usersSection.appendChild(NYTMM.createElement("ul", "", "userStories clearfix"));
        this.userList = [user1, user2]
        this.windowHeight = document.viewport.getDimensions().height
        document.observe(NYTMM.ComingOut.IntroMenuItem.START_EVENT, this.scrollToItemAt.bind(this, 1));
        document.observe(NYTMM.ComingOut.IntroMenuItem.JUMP_EVENT, function (e) {
            this.scrollToItemAt(e.memo.index);
        }.bind(this));
        document.observe(NYTMM.ComingOut.IntroMenuItem.START_USER_STORIES_EVENT, this.scrollToItemAt.bind(this, this.stories.length + 1));
    },
    isItemDisabled: function (index) {
        return (this.introItem.isItemDisabled(index));
    },
    buildUserList: function (its) {
        if (its) this.userStories = its.slice(0);
        if (!this.active) {
            this.pendingUserListBuild = true;
            return;
        }
        this.pendingUserListBuild = false;
        this.userList[0].innerHTML = "";
        this.userList[1].innerHTML = "";
        this.userItems = [];
        var iw = 0;
        var firstColItem;
        for (var i = 0; i < this.userStories.length; i++) {
            var s = this.userStories[i]
            //			if(i%2 == 0) {
            //				var oiw = iw = 970 - iw
            //				while(Math.abs(oiw-iw) < 20) {
            //					iw =  Math.round((Math.random()*0.3+0.35)*970)
            //			}
            //			// second item in row
            //
            //			}
            var ui = new NYTMM.ComingOut.UserMenuItem(s, iw);
            this.userItems.push(ui)
            this.userList[i % 2].appendChild(ui.layout);
            ui.createSummary();
            var h = Math.ceil(ui.getHeight())
            //
            //
            //				ui.setHeight(h)
            firstColItem = (i % 2 == 0) ? ui : null;
        }
        var length = this.userStories.length;
        var blanks = $$('.userCount');
        for (var i = 0; i < blanks.length; i++) {
            blanks[i].update(length);
        }
    },
    setActive: function (a) {
        this.active = a;
        if (a) {
            this.updateOffsets();
            this.onWindowResize();
            Event.observe(window, "scroll", this.windowScrollCallback);
            Event.observe(window, "resize", this.windowSizeCallback);
            if (this.pendingUserListBuild) this.buildUserList();
        } else {
            Event.stopObserving(window, "scroll", this.windowScrollCallback);
            Event.stopObserving(window, "resize", this.windowSizeCallback);
        }
    },
    onWindowResize: function (e) {
        this.windowHeight = document.viewport.getDimensions().height;
        this.onWindowScroll();
    },
    onWindowScroll: function (e) {
        var st = document.viewport.getScrollOffsets().top;
        var sy = st + this.windowHeight / 2;
        sy -= this.offsetTop;
        var iy = 0;
        var ofi = this.focusedIndex;
        this.focusedIndex = -1;
        for (var i = 0; i < this.menuItems.length; i++) {
            var si = this.menuItems[i];
            if ((sy >= iy || i == 0) && sy < iy + si.height) {
                si.focus();
                this.focusedIndex = i;
                if (this.menuItems[this.focusedIndex] instanceof NYTMM.ComingOut.StoryMenuItem) {
                    this.menuItems[this.focusedIndex].updateQuoteScroll(iy, sy);
                }
            } else si.unfocus();
            iy += si.height + 50;
        }
        if (this.focusedIndex < 0 && ofi >= 0) {
            Effect.Queues.get("usersSection").invoke("cancel");
            new Effect.Appear(this.usersSection, {
                duration: 0,
                transition: Effect.Transitions.full,
                queue: {
                    scope: "usersSection"
                }
            });
        } else if (this.focusedIndex >= 0 && ofi < 0) {
            Effect.Queues.get("usersSection").invoke("cancel");
            if (NYTMM.platform != NYTMM.Platforms.IPAD && NYTMM.platform != NYTMM.Platforms.IPHONE) {
                new Effect.Fade(this.usersSection, {
                    to: 0.2,
                    duration: 0,
                    transition: Effect.Transitions.full,
                    queue: {
                        scope: "usersSection"
                    }
                });
            }
        }
    },
    updateOffsets: function () {
        try {
            this.offsetTop = this.layout.cumulativeOffset().top;
        } catch (e) {
            this.offsetTop = 0;
        }
        this.onWindowScroll();
    },
    scrollToItemAt: function (i, duration) {
        var iy = this.offsetTop;
        for (var j = 0; j <= i && j < this.menuItems.length; j++) {
            var mi = this.menuItems[j];
            if (j == i) {
                iy -= Math.round((this.windowHeight - mi.height) / 2);
                this.scrollTo(iy);
                return;
            }
            iy += mi.height + 50
        }
        this.scrollTo(iy - 40);
    },
    scrollToStory: function (s, duration) {
        var iy = this.offsetTop;
        var mi;
        for (var i = 0; i < this.menuItems.length; i++) {
            mi = this.menuItems[i];
            if (mi instanceof NYTMM.ComingOut.StoryMenuItem) {
                if (mi.story == s) {
                    iy -= Math.round((this.windowHeight - mi.height) / 2);
                    this.scrollTo(iy);
                    return;
                }
            }
            iy += mi.height;
        }
        for (var i = 0; i < this.userItems.length; i++) {
            mi = this.userItems[i];
            if (mi instanceof NYTMM.ComingOut.UserMenuItem) {
                if (mi.story == s) {
                    this.scrollTo(iy - 40);
                    return;
                }
            }
        }
    },
    scrollToNext: function () {
        var st = document.viewport.getScrollOffsets().top;
        var sc = st + this.windowHeight / 2;
        var iy = this.offsetTop;
        for (var i = 0; i < this.menuItems.length; i++) {
            var mi = this.menuItems[i];
            if (iy + mi.height / 2 - 10 > sc) {
                iy -= Math.round((this.windowHeight - mi.height) / 2);
                this.scrollTo(iy, 0.6);
                return;
            }
            iy += mi.height + 50;
        }
        this.scrollTo(iy - 40, 0.6);
    },
    scrollToPrev: function () {
        var st = document.viewport.getScrollOffsets().top;
        var sc = st + this.windowHeight / 2;
        var iy = this.offsetTop;
        for (var i = 0; i < this.menuItems.length; i++) {
            var mi = this.menuItems[i];
            if (i > 0 && iy + mi.height / 2 + 10 > sc) {
                iy -= mi.height + Math.round((this.windowHeight - this.menuItems[i - 1].height) / 2);
                this.scrollTo(iy, 0.6);
                return;
            }
            iy += mi.height + 50;
        }
        iy -= this.menuItems[i - 1].height + Math.round((this.windowHeight - mi.height) / 2);
        this.scrollTo(iy, 0.6);
    },
    scrollTo: function (sy, d) {
        var st = document.viewport.getScrollOffsets().top;
        if (d == null) d = 1;
        Effect.Queues.get("menuScroll").invoke("cancel");
        new Effect.Tween(null, st, sy, {
            duration: d,
            afterFinish: this.onWindowScroll.bind(this),
            queue: {
                scope: "menuScroll"
            }
        }, function (p) {
            scrollTo(0, p)
        });
    }
});
NYTMM.ComingOut.MenuItem = Class.create({
    initialize: function () {
        this.id = "menuItem" + (NYTMM.ComingOut.MenuItem.numItems++);
        this.height = 520
        this.focused = false;
    },
    focus: function (anim) {
        if (this.focused) return;
        this.focused = true;
        var dm = (anim == null || anim) ? 1 : 0;
        Effect.Queues.get(this.id).invoke("cancel");
        if (this.layout) new Effect.Appear(this.layout, {
                duration: 0.3 * dm,
                transition: Effect.Transitions.linear,
                queue: {
                    scope: this.id
                }
            });
    },
    unfocus: function (anim, force) {
        if (NYTMM.platform == NYTMM.Platforms.IPAD || NYTMM.platform == NYTMM.Platforms.IPHONE) return;
        if (!this.focused && !force) return;
        this.focused = false;
        var dm = (anim == null || anim) ? 1 : 0;
        Effect.Queues.get(this.id).invoke("cancel");
        if (this.layout) new Effect.Fade(this.layout, {
                to: 0.2,
                duration: 0.3 * dm,
                transition: Effect.Transitions.linear,
                queue: {
                    scope: this.id
                }
            });
    }
})
NYTMM.ComingOut.MenuItem.PLAY_EVENT = "NYTMM.ComingOut.MenuItem:play_story";
NYTMM.ComingOut.MenuItem.numItems = 0;
NYTMM.ComingOut.IntroMenuItem = Class.create(NYTMM.ComingOut.MenuItem, {
    initialize: function ($super) {
        $super()
        var introData = NYTMM.ComingOut.app.data.intro
        this.height = 520
        this.layout = NYTMM.createElement("div", "", "nytmm_comingOut_introMenuItem", {
            id: this.id
        });
        this.intro = this.layout.appendChild(NYTMM.createElement("p", introData.text || "", "introText"));
        this.startButton = this.intro.appendChild(NYTMM.createElement("div", "", "startButton"));
        this.startButton.insert(NYTMM.ButtonFactory.notchedButton('View Their Stories', '#666666'));
        this.startButton.observe("click", this.onStartClick.bind(this))
        this.subNav = this.layout.appendChild(NYTMM.createElement('div', '', 'subNav clearfix'))
        for (var i = 0; i < introData.subnav.length; i++) {
            var subItem = introData.subnav[i];
            var item = this.subNav.appendChild(NYTMM.createElement('div', subItem.label, 'subNavItem'));
            item.insert({
                'top': NYTMM.createElement('div', '&#9654;', 'arrow')
            });
            if (!subItem.enabled) {
                item.addClassName('disabled');
                item.insert({
                    'top': NYTMM.createElement('div', subItem.release, 'releaseDate')
                });
            } else {
                if (i == 5) { // comments hack
                    item.innerHTML = item.innerHTML + ' (<span class="userCount">0</span>)';
                } else {}
                item.observe('click', function (index) {
                    document.fire(NYTMM.ComingOut.IntroMenuItem.JUMP_EVENT, {
                        index: index,
                        target: this
                    });
                }.bind(this, i + 1));
            }
        };
        this.subNav.appendChild(NYTMM.createElement('p', 'Reported by Sarah Kramer | Photography by Nicole Bengiveno', 'mmcredit'))
        //this.startUserStoriesButton.observe("click",this.onStartUserStoriesClick.bind(this));
    },
    isItemDisabled: function (index) {
        var items = this.subNav.select('.subNavItem');
        return (items[index].hasClassName('disabled'));
    },
    onStartClick: function (e) {
        document.fire(NYTMM.ComingOut.IntroMenuItem.START_EVENT, {
            target: this
        });
    },
    onStartUserStoriesClick: function (e) {
        document.fire(NYTMM.ComingOut.IntroMenuItem.START_USER_STORIES_EVENT, {
            target: this
        });
    }
});
NYTMM.ComingOut.IntroMenuItem.JUMP_EVENT = "NYTMM.ComingOut.StoryMenuItem:jump";
NYTMM.ComingOut.IntroMenuItem.START_EVENT = "NYTMM.ComingOut.StoryMenuItem:start";
NYTMM.ComingOut.IntroMenuItem.START_USER_STORIES_EVENT = "NYTMM.ComingOut.StoryMenuItem:start_user_stories";
NYTMM.ComingOut.StoryMenuItem = Class.create(NYTMM.ComingOut.MenuItem, {
    initialize: function ($super, data) {
        $super()
        this.story = data;
        this.height = 520
        this.layout = NYTMM.createElement("div", "", "nytmm_comingOut_storyMenuItem", {
            id: this.id
        });
        this.bg = this.layout.appendChild(NYTMM.createElement("img", null, "bg", {
            src: this.story.menuImage
        }))
        this.overlay = this.layout.appendChild(NYTMM.createElement("div", "", "overlay"));
        this.overlay.appendChild(NYTMM.createElement("div", "", "overlayBg"));
        var oc = this.overlay.appendChild(NYTMM.createElement("div", "", "overlayContent"))
        oc.appendChild(NYTMM.createElement("h4", this.story.name));
        oc.appendChild(document.createTextNode(this.story.age + " years old, " + this.story.location));
        setTimeout(this.showNumComments.bind(this), 9000)
        // play button image
        this.playImage = NYTMM.createElement("img", null, "playImage", {
            src: "http://graphics8.nytimes.com/images/multimedia/play_overlay_60.gif"
        });
        oc.insert({
            "before": this.playImage
        });
        this.playImage.setOpacity(.3)
        this.playButton = this.layout.appendChild(NYTMM.createElement("div", "", "overlayPlayButton"));
        this.playButton.observe("click", this.onPlayClick.bind(this));
        this.playButton.observe("mouseover", this.onPlayOverlayOver.bind(this));
        this.playButton.observe("mouseout", this.onPlayOverlayOut.bind(this))
        //		this.quote = this.layout.appendChild(NYTMM.createElement("div",this.story.quote,"quote",null,{left:this.story.quoteX+"px",top:this.story.quoteY+"px"}));
        this.quote = NYTMM.createElement("div", '<p style="left:' + this.story.quoteX + "px;top:" + this.story.quoteY + 'px">' + this.story.quote + '</p>', "quote", null, {})
        //		this.quote.appendChild(NYTMM.createElement("img",null,"leftQuoteMark",{src:NYTMM.ComingOut.imageBase+"quote_left.gif"}));
        this.playImage.insert({
            "before": this.quote
        })
        //this.quoteShadow = this.quote.appendChild(NYTMM.createElement("div",this.story.quote,"quoteShadow"));
        this.unfocus(false, true);
    },
    showNumComments: function () {
        if (!this.overlay) return;
        var oc = this.overlay.down(".overlayContent");
        if (!oc) return;
        var numComments = this.getNumComments();
        if (numComments == undefined || numComments <= 0) return;
        oc.appendChild(NYTMM.createElement("div", numComments + " Readers' comments", 'commentCount'));
    },
    getNumComments: function () {
        NYTMM.log(this.story.topicId);
        var comments = $$('#nytint .nytmm-comments')[this.story.topicId];
        if (comments) {
            var heading = comments.down('.nytint-comment-heading');
            if (heading) {
                var s = heading.innerHTML;
                var regex = /^\s*\d+/;
                NYTMM.log(s);
                return regex.exec(s)[0];
            }
        }
        return -1;
    },
    onPlayOverlayOver: function () {
        Effect.Queues.get(this.id + "playImage").invoke("cancel");
        new Effect.Appear(this.playImage, {
            to: 0.7,
            duration: 0.2,
            transition: Effect.Transitions.linear,
            queue: {
                scope: this.id + "playImage"
            }
        });
    },
    onPlayOverlayOut: function () {
        Effect.Queues.get(this.id + "playImage").invoke("cancel");
        new Effect.Fade(this.playImage, {
            duration: 0.2,
            to: .3,
            transition: Effect.Transitions.linear,
            queue: {
                scope: this.id + "playImage"
            }
        });
    },
    focus: function (anim) {
        if (this.focused) return;
        this.focused = true;
        var dm = (anim == null || anim) ? 1 : 0;
        Effect.Queues.get(this.id).invoke("cancel");
        Effect.Queues.get(this.id + "playButton").invoke("cancel");
        new Effect.Appear(this.bg, {
            duration: 0.6 * dm,
            transition: Effect.Transitions.linear,
            queue: {
                scope: this.id
            }
        });
        new Effect.Morph(this.overlay, {
            style: "bottom:0px",
            duration: 0.3 * dm,
            queue: {
                scope: this.id
            }
        })
        //this.playImage.style.bottom = "70px";
        this.quote.show();
    },
    unfocus: function (anim, force) {
        if (NYTMM.platform == NYTMM.Platforms.IPAD || NYTMM.platform == NYTMM.Platforms.IPHONE) return;
        if (!this.focused && !force) return;
        this.focused = false;
        var dm = (anim == null || anim) ? 1 : 0;
        Effect.Queues.get(this.id).invoke("cancel");
        Effect.Queues.get(this.id + "playButton").invoke("cancel");
        new Effect.Fade(this.bg, {
            to: 0.2,
            duration: 0.6 * dm,
            transition: Effect.Transitions.linear,
            queue: {
                scope: this.id
            }
        });
        new Effect.Morph(this.overlay, {
            style: "bottom:-150px",
            duration: 0.3 * dm,
            queue: {
                scope: this.id
            }
        })
        //this.playImage.style.bottom = "10px";
        this.quote.hide();
    },
    onPlayClick: function () {
        document.fire(NYTMM.ComingOut.MenuItem.PLAY_EVENT, {
            target: this,
            story: this.story
        });
    },
    updateQuoteScroll: function (iy, sy) {
        return
        if (!this.focused) return;
        var qt = this.story.quoteY;
        sy -= iy;
        this.quote.style.top = (qt - sy / this.height * 120 + 60) + "px"
        //this.quoteShadow.style.top = (sy/this.height*40 - 20)+"px";
    }
});
NYTMM.ComingOut.UserMenuItem = Class.create(NYTMM.ComingOut.MenuItem, {
    initialize: function ($super, story, w) {
        $super()
        this.story = story
        this.width = w
        this.layout = NYTMM.createElement("li", "", "nytmm_comingOut_userMenuItem", {
            id: this.id
        }, {});
        if (w && w > 0) {
            this.layout.style.width = w + 'px';
        }
        if (w > 550) this.layout.addClassName("big");
        if (this.story.youTubeVideoId) this.layout.addClassName("videoStory");
        this.content = this.layout.appendChild(NYTMM.createElement("div", "", "userMenuItemContent"));
        this.head = this.content.appendChild(NYTMM.createElement("h3", this.story.title));
        var truncated = NYTMM.Strings.truncateWords(this.story.text, 20, 50);
        if (truncated.charAt(truncated.length - 1) != '.') {
            truncated += '.';
        }
        truncated += '..<span class="more">&raquo;</span>';
        this.intro = this.content.appendChild(NYTMM.createElement("p", truncated, "intro"))
        this.info = this.content.appendChild(NYTMM.createElement("div", "", "userMenuItemInfo"));
        this.info.appendChild(NYTMM.createElement("h5", this.story.name));
        if (this.story.age && this.story.age != "") this.info.appendChild(NYTMM.createElement("h6", this.story.age + " years old"));
        if (this.story.location && this.story.location != "") this.info.appendChild(NYTMM.createElement("h6", this.story.location));
        if (this.story.youTubeVideoId) {}
        this.layout.observe("click", this.onClick.bind(this));
    },
    createSummary: function () {},
    onClick: function () {
        document.fire(NYTMM.ComingOut.MenuItem.PLAY_EVENT, {
            target: this,
            story: this.story
        });
    },
    setHeight: function (h) {
        this.layout.style.height = h + "px";
    },
    getHeight: function () {
        return this.layout.getHeight();
    },
    setWidth: function (w) {
        this.layout.style.width = w + "px";
    },
    getWidth: function () {
        return this.width;
    }
});
if (typeof deconcept == "undefined") {
    var deconcept = new Object();
}
if (typeof deconcept.util == "undefined") {
    deconcept.util = new Object();
}
if (typeof deconcept.SWFObjectUtil == "undefined") {
    deconcept.SWFObjectUtil = new Object();
}
deconcept.SWFObject = function (_1, id, w, h, _5, c, _7, _8, _9, _a) {
    if (!document.getElementById) {
        return;
    }
    this.DETECT_KEY = _a ? _a : "detectflash";
    this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
    this.params = new Object();
    this.variables = new Object();
    this.attributes = new Array();
    if (_1) {
        this.setAttribute("swf", _1);
    }
    if (id) {
        this.setAttribute("id", id);
    }
    if (w) {
        this.setAttribute("width", w);
    }
    if (h) {
        this.setAttribute("height", h);
    }
    if (_5) {
        this.setAttribute("version", new deconcept.PlayerVersion(_5.toString().split(".")));
    }
    this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
    if (!window.opera && document.all && this.installedVer.major > 7) {
        deconcept.SWFObject.doPrepUnload = true;
    }
    if (c) {
        this.addParam("bgcolor", c);
    }
    var q = _7 ? _7 : "high";
    this.addParam("quality", q);
    this.setAttribute("useExpressInstall", false);
    this.setAttribute("doExpressInstall", false);
    var _c = (_8) ? _8 : window.location;
    this.setAttribute("xiRedirectUrl", _c);
    this.setAttribute("redirectUrl", "");
    if (_9) {
        this.setAttribute("redirectUrl", _9);
    }
};
deconcept.SWFObject.prototype = {
    useExpressInstall: function (_d) {
        this.xiSWFPath = !_d ? "expressinstall.swf" : _d;
        this.setAttribute("useExpressInstall", true);
    },
    setAttribute: function (_e, _f) {
        this.attributes[_e] = _f;
    },
    getAttribute: function (_10) {
        return this.attributes[_10];
    },
    addParam: function (_11, _12) {
        this.params[_11] = _12;
    },
    getParams: function () {
        return this.params;
    },
    addVariable: function (_13, _14) {
        this.variables[_13] = _14;
    },
    getVariable: function (_15) {
        return this.variables[_15];
    },
    getVariables: function () {
        return this.variables;
    },
    getVariablePairs: function () {
        var _16 = new Array();
        var key;
        var _18 = this.getVariables();
        for (key in _18) {
            _16[_16.length] = key + "=" + _18[key];
        }
        return _16;
    },
    getSWFHTML: function () {
        var _19 = "";
        if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
            if (this.getAttribute("doExpressInstall")) {
                this.addVariable("MMplayerType", "PlugIn");
                this.setAttribute("swf", this.xiSWFPath);
            }
            _19 = "<embed type=\"application/x-shockwave-flash\" src=\"" + this.getAttribute("swf") + "\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\"";
            _19 += " id=\"" + this.getAttribute("id") + "\" name=\"" + this.getAttribute("id") + "\" ";
            var _1a = this.getParams();
            for (var key in _1a) {
                _19 += [key] + "=\"" + _1a[key] + "\" ";
            }
            var _1c = this.getVariablePairs().join("&");
            if (_1c.length > 0) {
                _19 += "flashvars=\"" + _1c + "\"";
            }
            _19 += "/>";
        } else {
            if (this.getAttribute("doExpressInstall")) {
                this.addVariable("MMplayerType", "ActiveX");
                this.setAttribute("swf", this.xiSWFPath);
            }
            _19 = "<object id=\"" + this.getAttribute("id") + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\">";
            _19 += "<param name=\"movie\" value=\"" + this.getAttribute("swf") + "\" />";
            var _1d = this.getParams();
            for (var key in _1d) {
                _19 += "<param name=\"" + key + "\" value=\"" + _1d[key] + "\" />";
            }
            var _1f = this.getVariablePairs().join("&");
            if (_1f.length > 0) {
                _19 += "<param name=\"flashvars\" value=\"" + _1f + "\" />";
            }
            _19 += "</object>";
        }
        return _19;
    },
    write: function (_20) {
        if (this.getAttribute("useExpressInstall")) {
            var _21 = new deconcept.PlayerVersion([6, 0, 65]);
            if (this.installedVer.versionIsValid(_21) && !this.installedVer.versionIsValid(this.getAttribute("version"))) {
                this.setAttribute("doExpressInstall", true);
                this.addVariable("MMredirectURL", escape(this.getAttribute("xiRedirectUrl")));
                document.title = document.title.slice(0, 47) + " - Flash Player Installation";
                this.addVariable("MMdoctitle", document.title);
            }
        }
        if (this.skipDetect || this.getAttribute("doExpressInstall") || this.installedVer.versionIsValid(this.getAttribute("version"))) {
            var n = (typeof _20 == "string") ? document.getElementById(_20) : _20;
            n.innerHTML = this.getSWFHTML();
            return true;
        } else {
            if (this.getAttribute("redirectUrl") != "") {
                document.location.replace(this.getAttribute("redirectUrl"));
            }
        }
        return false;
    }
};
deconcept.SWFObjectUtil.getPlayerVersion = function () {
    var _23 = new deconcept.PlayerVersion([0, 0, 0]);
    if (navigator.plugins && navigator.mimeTypes.length) {
        var x = navigator.plugins["Shockwave Flash"];
        if (x && x.description) {
            _23 = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
        }
    } else {
        if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0) {
            var axo = 1;
            var _26 = 3;
            while (axo) {
                try {
                    _26++;
                    axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + _26);
                    _23 = new deconcept.PlayerVersion([_26, 0, 0]);
                } catch (e) {
                    axo = null;
                }
            }
        } else {
            try {
                var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
            } catch (e) {
                try {
                    var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
                    _23 = new deconcept.PlayerVersion([6, 0, 21]);
                    axo.AllowScriptAccess = "always";
                } catch (e) {
                    if (_23.major == 6) {
                        return _23;
                    }
                }
                try {
                    axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
                } catch (e) {}
            }
            if (axo != null) {
                _23 = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
            }
        }
    }
    return _23;
};
deconcept.PlayerVersion = function (_29) {
    this.major = _29[0] != null ? parseInt(_29[0]) : 0;
    this.minor = _29[1] != null ? parseInt(_29[1]) : 0;
    this.rev = _29[2] != null ? parseInt(_29[2]) : 0;
};
deconcept.PlayerVersion.prototype.versionIsValid = function (fv) {
    if (this.major < fv.major) {
        return false;
    }
    if (this.major > fv.major) {
        return true;
    }
    if (this.minor < fv.minor) {
        return false;
    }
    if (this.minor > fv.minor) {
        return true;
    }
    if (this.rev < fv.rev) {
        return false;
    }
    return true;
};
deconcept.util = {
    getRequestParameter: function (_2b) {
        var q = document.location.search || document.location.hash;
        if (_2b == null) {
            return q;
        }
        if (q) {
            var _2d = q.substring(1).split("&");
            for (var i = 0; i < _2d.length; i++) {
                if (_2d[i].substring(0, _2d[i].indexOf("=")) == _2b) {
                    return _2d[i].substring((_2d[i].indexOf("=") + 1));
                }
            }
        }
        return "";
    }
};
deconcept.SWFObjectUtil.cleanupSWFs = function () {
    var _2f = document.getElementsByTagName("OBJECT");
    for (var i = _2f.length - 1; i >= 0; i--) {
        _2f[i].style.display = "none";
        for (var x in _2f[i]) {
            if (typeof _2f[i][x] == "function") {
                _2f[i][x] = function () {};
            }
        }
    }
};
if (deconcept.SWFObject.doPrepUnload) {
    if (!deconcept.unloadSet) {
        deconcept.SWFObjectUtil.prepUnload = function () {
            __flash_unloadHandler = function () {};
            __flash_savedUnloadHandler = function () {};
            window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
        };
        window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
        deconcept.unloadSet = true;
    }
}
if (!document.getElementById && document.all) {
    document.getElementById = function (id) {
        return document.all[id];
    };
}
if (typeof SWFObject == "undefined") {
    var getQueryParamValue = deconcept.util.getRequestParameter;
    var FlashObject = deconcept.SWFObject;
    var SWFObject = deconcept.SWFObject;
}
if (!SWFObject.swfEvents && !SWFObject.swfListeners) {
    SWFObject.swfEvents = new Object();
    SWFObject.swfListeners = new Object();
    SWFObject.dispatchEventToSWF = function (sid, e) {
        var evts = SWFObject.swfEvents["s" + sid];
        if (evts == null) evts = [];
        evts.push(e);
        SWFObject.swfEvents["s" + sid] = evts;
    }
    SWFObject.cancelEventsToSWF = function (sid, type) {
        var evts = SWFObject.swfEvents["s" + sid];
        if (evts == null) return;
        for (var i = 0; i < evts.length; i++) {
            if (type == null || evts[i].type == type) {
                evts.splice(i, 1);
                i--;
            }
        }
    }
    SWFObject.hasEventsFor = function (sid) {
        var evts = SWFObject.swfEvents["s" + sid];
        return (evts && evts.length > 0);
    }
    SWFObject.getEventsFor = function (sid) {
        var evts = SWFObject.swfEvents["s" + sid];
        if (evts) {
            SWFObject.swfEvents["s" + sid] = [];
            return evts;
        }
        return [];
    }
    SWFObject.addSWFEventListener = function (swfId, eType, callback) {
        swfId = swfId.replace(/[^\w]/g, "");
        if (SWFObject.swfListeners["swf" + swfId] == null) {
            SWFObject.swfListeners["swf" + swfId] = [{
                    id: swfId,
                    type: eType,
                    callback: callback
                }
            ];
        } else SWFObject.swfListeners["swf" + swfId].push({
                id: swfId,
                type: eType,
                callback: callback
            });
    }
    SWFObject.onSWFEvent = function (e) {
        if (e.type == null || e.target == null) return;
        var swfId = e.target.replace(/[^\w]/g, "");
        var listeners = SWFObject.swfListeners["swf" + swfId];
        if (listeners == null) return;
        for (var i = 0; i < listeners.length; i++) {
            if (listeners[i].id == swfId && listeners[i].type == e.type) listeners[i].callback(e);
        }
    }
}
if (typeof NYTMM != 'undefined' && typeof NYTMM.VideoPlayer == 'undefined') {
    NYTMM.VideoPlayer = Class.create({
        // videWidth: width of video screen
        // sources: array of objects in the form of [ {src,type} , {src,type} , ... ]
        initialize: function (parent, videoWidth, videoHeight, sources, opts) {
            this.player;
            this.poster;
            this.players = new Object();
            this.containers = new Object()
            this.id = (NYTMM.VideoPlayer.lastId++);
            this.parent = parent;
            this.videoWidth = videoWidth;
            this.videoHeight = videoHeight;
            this.sources = [];
            this.flashPlayerVars = {}
            this.options = {
                flashVersion: 9,
                skin: "light",
                autoPlay: false,
                preload: true,
                autoRewind: true,
                controlsBelow: true,
                showControls: true, // show controls at all?
                fullScreen: false
            };
            if (opts) {
                for (var a in opts) this.options[a] = opts[a];
            }
            this.flashPlayerURL = "http://graphics8.nytimes.com/packages/flash/multimedia/VIDEO_PLAYER/NYTVideoEmbed2.swf";
            this.playerType;
            this.layout = NYTMM.createElement("div", "", "nytmm_videoPlayer", null, {
                width: videoWidth + "px"
            });
            if (this.options.controlsBelow) this.layout.addClassName("vjs-controls-below");
            if (this.parent) this.parent.appendChild(this.layout);
            this.buildPlayer(NYTMM.VideoPlayer.NO_PLAYER);
            if (sources) this.setSources(sources);
        },
        setSource: function (src, type) {
            if (type == null) type = NYTMM.VideoPlayer.getVideoTypeFromSource(src);
            this.setSources([{
                    src: src,
                    type: type
                }
            ]);
        },
        setSources: function (srcs) {
            this.sources = srcs.slice(0)
            for (var i = 0; i < this.sources.length; i++) {
                if (typeof this.sources[i].toLowerCase != "undefined") {
                    var src = this.sources[i];
                    this.sources[i] = {
                        src: src,
                        type: NYTMM.VideoPlayer.getVideoTypeFromSource(src)
                    }
                }
            }
            this.playerType = null;
            this.player = null;
            var t
            if (NYTMM.getFlashVersion() > this.options.flashVersion) {
                for (i = 0; i < this.sources.length; i++) {
                    t = this.sources[i].type;
                    if (t == NYTMM.VideoPlayer.H264_VIDEO_TYPE || t == NYTMM.VideoPlayer.FLV_VIDEO_TYPE ||
                        t == NYTMM.VideoPlayer.F4V_VIDEO_TYPE || t == NYTMM.VideoPlayer.YOUTUBE_VIDEO_TYPE ||
                        t == NYTMM.VideoPlayer.BRIGHTCOVE_VIDEO_TYPE) {
                        this.setSupportedSource(this.sources[i].src, NYTMM.VideoPlayer.FLASH_PLAYER);
                        break;
                    }
                }
            }
            if (this.playerType == null && NYTMM.VideoPlayer.browserSupportsVideo()) {
                this.buildPlayer(NYTMM.VideoPlayer.HTML5_PLAYER);
                var vp = this.players[NYTMM.VideoPlayer.HTML5_PLAYER]
                for (i = 0; i < this.sources.length; i++) {
                    t = this.sources[i].type;
                    if (t == NYTMM.VideoPlayer.H264_VIDEO_TYPE || t == NYTMM.VideoPlayer.VP8_VIDEO_TYPE || t == NYTMM.VideoPlayer.THEORA_VIDEO_TYPE) {
                        var canPlay = vp.canPlayType(t)
                        if (canPlay == "probably" || canPlay == "maybe") {
                            this.setSupportedSource(this.sources[i].src, NYTMM.VideoPlayer.HTML5_PLAYER);
                            break;
                        }
                    } else if (t == NYTMM.VideoPlayer.YOUTUBE_VIDEO_TYPE) {
                        this.buildPlayer(NYTMM.VideoPlayer.HTML5_YOUTUBE_PLAYER);
                        this.setSupportedSource(this.sources[i].src, NYTMM.VideoPlayer.HTML5_YOUTUBE_PLAYER);
                        break;
                    }
                }
            }
            if (this.playerType == null) {
                this.setSupportedSource("", null);
            }
        },
        setSupportedSource: function (src, forPlayerType) {
            this.playerType = "";
            this.player = null;
            if (forPlayerType == null) forPlayerType = this.playerType;
            var vp = this.players[forPlayerType];
            if (!vp) {
                this.buildPlayer(forPlayerType);
                vp = this.players[forPlayerType];
            }
            this.playerType = forPlayerType;
            this.player = vp;
            this.setSourceForPlayer(src, forPlayerType);
            this.setPoster(this.poster)
            for (var c in this.containers) this.containers[c].style.display = "none"
            if (this.playerType == NYTMM.VideoPlayer.FLASH_PLAYER) {
                this.containers[this.playerType].style.display = "block";
            } else if (this.playerType == NYTMM.VideoPlayer.HTML5_PLAYER) {
                this.containers[this.playerType].style.display = "block";
            } else if (this.playerType == NYTMM.VideoPlayer.HTML5_YOUTUBE_PLAYER) {
                this.containers[this.playerType].style.display = "block";
            } else {
                this.playerType = NYTMM.VideoPlayer.NO_PLAYER;
                this.containers[NYTMM.VideoPlayer.NO_PLAYER].style.display = "block";
            }
        },
        setSourceForPlayer: function (src, pType) {
            var vp = this.players[pType];
            if (!vp) return
            if (pType == NYTMM.VideoPlayer.FLASH_PLAYER) {
                SWFObject.cancelEventsToSWF(vp.id, "videoId");
                SWFObject.dispatchEventToSWF(vp.id, {
                    type: "videoId",
                    videoId: src
                })
            } else if (pType == NYTMM.VideoPlayer.HTML5_PLAYER) {
                if (vp.src != src) {
                    vp.setAttribute("src", src);
                    vp.load();
                }
            } else if (pType == NYTMM.VideoPlayer.HTML5_YOUTUBE_PLAYER) {
                vp.setAttribute("src", "http://www.youtube.com/embed/" + src);
            }
        },
        buildPlayer: function (type) {
            if (this.players[type] != null) return;
            if (type == NYTMM.VideoPlayer.FLASH_PLAYER) {
                this.containers[type] = this.layout.appendChild(NYTMM.createElement("div", "", "", {
                    id: "nytmm_flashVideoContainer" + this.id
                }, {
                    display: "none"
                }));
                var swfId = 'nytmm_flashVideoPlayer' + this.id;
                var w = this.videoWidth;
                var h = this.videoHeight + ((this.options.controlsBelow) ? 40 : 0)
                var so = new SWFObject(this.flashPlayerURL, swfId, w, h, 9, '#ffffff');
                so.addParam('allowScriptAccess', 'always');
                so.addParam('allowFullScreen', 'true');
                so.addParam('wmode', 'transparent');
                so.addVariable('videoWidth', this.videoWidth);
                so.addVariable('videoHeight', this.videoHeight);
                so.addVariable('skin', this.options.skin);
                so.addVariable('autoPlay', (this.options.autoPlay) ? "true" : "false");
                so.addVariable('autoRewind', (this.options.autoRewind) ? "true" : "false");
                so.addVariable('overlayMode', (this.options.controlsBelow) ? "false" : "true");
                so.addVariable('showControls', (this.options.showControls) ? "true" : "false");
                so.addVariable('fullScreen', (this.options.fullScreen) ? "true" : "false");
                so.addVariable('embedId', swfId);
                for (var a in this.flashPlayerVars) so.addVariable(a, this.flashPlayerVars[a]);
                so.write("nytmm_flashVideoContainer" + this.id);
                this.players[type] = $('nytmm_flashVideoPlayer' + this.id);
                SWFObject.addSWFEventListener(this.players[type].id, "play", this.onPlay.bind(this));
                SWFObject.addSWFEventListener(this.players[type].id, "pause", this.onPause.bind(this));
                SWFObject.addSWFEventListener(this.players[type].id, "end", this.onEnd.bind(this));
            } else if (type == NYTMM.VideoPlayer.HTML5_PLAYER) {
                this.containers[type] = this.layout.appendChild(NYTMM.createElement("div", "", "", {
                    id: "nytmm_html5VideoContainer" + this.id
                }, {
                    display: "none"
                }))
                this.video = NYTMM.createElement("video", "", "video-js", {
                    id: "nytmm_html5VideoPlayer" + this.id,
                    width: this.videoWidth,
                    height: this.videoHeight,
                    poster: ""
                });
                this.video.preload = true;
                this.video.controls = this.options.showControls;
                this.video.autoplay = this.options.autoPlay
                if (typeof this.video.hasAttribute == "function" && this.video.hasAttribute("preload")) {
                    this.video.autobuffer = true;
                }
                this.players[type] = this.video;
                this.containers[type].appendChild(this.video)
                //this.video.addEventListener("timeupdate", this.onTimeUpdate.bind(this), false);
                this.video.addEventListener("play", this.onPlay.bind(this, {
                    target: this.video.id,
                    type: "play"
                }), false);
                this.video.addEventListener("pause", this.onPause.bind(this, {
                    target: this.video.id,
                    type: "pause"
                }), false);
                this.video.addEventListener("ended", this.onEnd.bind(this, {
                    target: this.video.id,
                    type: "end"
                }), false);
            } else if (type == NYTMM.VideoPlayer.HTML5_YOUTUBE_PLAYER) {
                var fr = this.layout.appendChild(NYTMM.createElement("iframe", "", "", {
                    frameborder: 0
                }, {
                    height: this.videoHeight + "px",
                    width: this.videoWidth + "px"
                }));
                this.players[type] = fr;
                this.containers[type] = fr;
            } else if (type == NYTMM.VideoPlayer.NO_PLAYER) {
                var nvc = this.layout.appendChild(NYTMM.createElement("div", "", "nytmm_noVideoContainer", null, {
                    height: this.videoHeight + "px",
                    width: this.videoWidth + "px"
                }));
                nvc.appendChild(NYTMM.createElement("div", "Unsupported Video", "message", null, {
                    paddingTop: (Math.round(this.videoHeight - 20) / 2) + "px"
                }));
                this.containers[type] = nvc;
            }
        },
        canPlaySource: function () {
            for (var i = 0; i < this.sources.length; i++) {
                var canPlay = this.video.canPlayType(this.sources[i].type)
                if (canPlay == "probably" || canPlay == "maybe") return true;
            }
            return false;
        },
        setPoster: function (url, pType) {
            if (pType == null) pType = this.playerType;
            if (url == null) url = "";
            this.poster = url;
            var vp = this.players[this.playerType];
            if (!vp) return;
            if (this.playerType == NYTMM.VideoPlayer.FLASH_PLAYER) {
                SWFObject.dispatchEventToSWF(vp.id, {
                    type: "imagePath",
                    url: url
                });
            } else if (this.playerType == NYTMM.VideoPlayer.HTML5_PLAYER) {
                vp.poster = url;
            }
        },
        unload: function () {
            var ps = this.poster;
            for (var pt in this.players) {
                this.stop(pt)
                //this.setPoster("",pt);
            }
            this.poster = ps;
        },
        play: function (pType) {
            if (pType == null) pType = this.playerType;
            var vp = this.players[pType];
            if (vp == null || pType == NYTMM.VideoPlayer.HTML5_YOUTUBE_PLAYER) return
            if (pType == NYTMM.VideoPlayer.FLASH_PLAYER) SWFObject.dispatchEventToSWF(vp.id, {
                    type: "play"
                });
            else if (pType == NYTMM.VideoPlayer.HTML5_PLAYER) vp.play();
        },
        pause: function (pType) {
            if (pType == null) pType = this.playerType;
            var vp = this.players[pType];
            if (vp == null || pType == NYTMM.VideoPlayer.HTML5_YOUTUBE_PLAYER) return
            if (pType == NYTMM.VideoPlayer.FLASH_PLAYER) SWFObject.dispatchEventToSWF(vp.id, {
                    type: "pause"
                });
            else if (pType == NYTMM.VideoPlayer.HTML5_PLAYER) vp.pause();
        },
        stop: function (pType) {
            if (pType == null) pType = this.playerType;
            var vp = this.players[pType];
            if (vp == null || pType == NYTMM.VideoPlayer.HTML5_YOUTUBE_PLAYER) return
            if (pType == NYTMM.VideoPlayer.FLASH_PLAYER) SWFObject.dispatchEventToSWF(vp.id, {
                    type: "stop"
                });
            else if (pType == NYTMM.VideoPlayer.HTML5_PLAYER) {
                vp.currentTime = 0;
                vp.pause();
            }
        },
        seek: function (p, pType) {
            if (pType == null) pType = this.playerType;
            var vp = this.players[pType];
            if (vp == null || pType == NYTMM.VideoPlayer.HTML5_YOUTUBE_PLAYER) return
            if (pType == NYTMM.VideoPlayer.FLASH_PLAYER) SWFObject.dispatchEventToSWF(vp.id, {
                    type: "seek",
                    position: p
                });
            else if (pType == NYTMM.VideoPlayer.HTML5_PLAYER) vp.currentTime = p;
        },
        setVolume: function (v, pType) {
            if (pType == null) pType = this.playerType;
            var vp = this.players[pType];
            if (vp == null || pType == NYTMM.VideoPlayer.HTML5_YOUTUBE_PLAYER) return
            if (pType == NYTMM.VideoPlayer.FLASH_PLAYER) SWFObject.dispatchEventToSWF(vp.id, {
                    type: "volume",
                    volume: v
                });
            else if (pType == NYTMM.VideoPlayer.HTML5_PLAYER) vp.volume = v;
        },
        onPlay: function (e) {
            document.fire(NYTMM.VideoPlayer.PLAY_EVENT, {
                target: this
            });
        },
        onPause: function (e) {
            document.fire(NYTMM.VideoPlayer.PAUSE_EVENT, {
                target: this
            });
        },
        onEnd: function (e) {
            document.fire(NYTMM.VideoPlayer.END_EVENT, {
                target: this
            });
        }
    })
    // Static
    NYTMM.VideoPlayer.FLASH_PLAYER = "flash";
    NYTMM.VideoPlayer.HTML5_PLAYER = "html5";
    NYTMM.VideoPlayer.HTML5_YOUTUBE_PLAYER = "html5_youtube";
    NYTMM.VideoPlayer.NO_PLAYER = "none";
    NYTMM.VideoPlayer.FLV_VIDEO_TYPE = "flv";
    NYTMM.VideoPlayer.F4V_VIDEO_TYPE = "f4v";
    NYTMM.VideoPlayer.YOUTUBE_VIDEO_TYPE = "youtube";
    NYTMM.VideoPlayer.BRIGHTCOVE_VIDEO_TYPE = "brightcove";
    NYTMM.VideoPlayer.H264_VIDEO_TYPE = "video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"";
    NYTMM.VideoPlayer.VP8_VIDEO_TYPE = "video/webm; codecs=\"vp8, vorbis\"";
    NYTMM.VideoPlayer.THEORA_VIDEO_TYPE = "video/ogg; codecs=\"theora, vorbis\"";
    NYTMM.VideoPlayer.PLAY_EVENT = "NYTMM.VideoPlayer:play";
    NYTMM.VideoPlayer.PAUSE_EVENT = "NYTMM.VideoPlayer:pause";
    NYTMM.VideoPlayer.END_EVENT = "NYTMM.VideoPlayer:end";
    NYTMM.VideoPlayer.players = [];
    NYTMM.VideoPlayer.lastId = 0
    NYTMM.VideoPlayer.getVideoPlayerById = function (id) {
        for (var i = 0; i < NYTMM.VideoPlayer.players.length; i++) {
            if (NYTMM.VideoPlayer.players[i] != null && NYTMM.VideoPlayer.players[i].id == id) return NYTMM.VideoPlayer.players[i];
        }
        return null;
    }
    NYTMM.VideoPlayer.getVideoTypeFromSource = function (src) {
        var type = "";
        if (src == "") return type;
        if (src.indexOf('.') > 0) {
            var ext = src.toString().split("?")[0];
            ext = ext.split(".").pop().toLowerCase();
            if (ext == "flv") type = NYTMM.VideoPlayer.FLV_VIDEO_TYPE;
            else if (ext == "f4v") type = NYTMM.VideoPlayer.F4V_VIDEO_TYPE;
            else if (ext == "mp4" || ext == "m4v") type = NYTMM.VideoPlayer.H264_VIDEO_TYPE;
            else if (ext == "ogg") type = NYTMM.VideoPlayer.THEORA_VIDEO_TYPE;
            else if (ext == "webm") type = NYTMM.VideoPlayer.VP8_VIDEO_TYPE;
        } else {
            if (src.search(/[a-zA-Z]/) < 0) type = NYTMM.VideoPlayer.BRIGHTCOVE_VIDEO_TYPE;
            else type = NYTMM.VideoPlayer.YOUTUBE_VIDEO_TYPE;
        }
        return type;
    }
    NYTMM.VideoPlayer.browserSupportsVideo = function () {
        if (typeof NYTMM.VideoPlayer.videoSupport != "undefined") return NYTMM.VideoPlayer.videoSupport;
        return NYTMM.VideoPlayer.videoSupport = !! document.createElement('video').canPlayType;
    };
}
if (typeof NYTMM != 'undefined' && typeof NYTMM.TimesStyle == 'undefined') {
    NYTMM.TimesStyle = ({
        DAYS: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
        DAYS_ABBR: ["Sun.", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat."],
        MONTHS: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
        MONTHS_ABBR: ["Jan.", "Feb.", "March", "April", "May", "June", "July", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."],
        STATES: [{
                abbr: "AK",
                name: "Alaska",
                style: "Alaska"
            }, {
                abbr: "AL",
                name: "Alabama",
                style: "Ala."
            }, {
                abbr: "AR",
                name: "Arkansas",
                style: "Ark."
            }, {
                abbr: "AZ",
                name: "Arizona",
                style: "Ariz."
            }, {
                abbr: "CA",
                name: "California",
                style: "Calif."
            }, {
                abbr: "CO",
                name: "Colorado",
                style: "Colo."
            }, {
                abbr: "CT",
                name: "Connecticut",
                style: "Conn."
            }, {
                abbr: "DE",
                name: "Delaware",
                style: "Del."
            }, {
                abbr: "FL",
                name: "Florida",
                style: "Fla."
            }, {
                abbr: "GA",
                name: "Georgia",
                style: "Ga."
            }, {
                abbr: "HI",
                name: "Hawaii",
                style: "Hawaii"
            }, {
                abbr: "IA",
                name: "Iowa",
                style: "Iowa"
            }, {
                abbr: "ID",
                name: "Idaho",
                style: "Idaho"
            }, {
                abbr: "IL",
                name: "Illinois",
                style: "Ill."
            }, {
                abbr: "IN",
                name: "Indiana",
                style: "Ind."
            }, {
                abbr: "KS",
                name: "Kansas",
                style: "Kan."
            }, {
                abbr: "KY",
                name: "Kentucky",
                style: "Ky."
            }, {
                abbr: "LA",
                name: "Louisiana",
                style: "La."
            }, {
                abbr: "MA",
                name: "Massachusetts",
                style: "Mass."
            }, {
                abbr: "MD",
                name: "Maryland",
                style: "Md."
            }, {
                abbr: "ME",
                name: "Maine",
                style: "Me."
            }, {
                abbr: "MI",
                name: "Michigan",
                style: "Mich."
            }, {
                abbr: "MN",
                name: "Minnesota",
                style: "Minn."
            }, {
                abbr: "MS",
                name: "Mississippi",
                style: "Miss."
            }, {
                abbr: "MO",
                name: "Missouri",
                style: "Mo."
            }, {
                abbr: "MT",
                name: "Montana",
                style: "Mont."
            }, {
                abbr: "NC",
                name: "North Carolina",
                style: "N.C."
            }, {
                abbr: "ND",
                name: "North Dakota",
                style: "N.D."
            }, {
                abbr: "NE",
                name: "Nebraska",
                style: "Neb."
            }, {
                abbr: "NH",
                name: "New Hampshire",
                style: "N.H."
            }, {
                abbr: "NJ",
                name: "New Jersey",
                style: "N.J."
            }, {
                abbr: "NM",
                name: "New Mexico",
                style: "N.M."
            }, {
                abbr: "NV",
                name: "Nevada",
                style: "Nev."
            }, {
                abbr: "NY",
                name: "New York",
                style: "N.Y."
            }, {
                abbr: "OH",
                name: "Ohio",
                style: "Ohio"
            }, {
                abbr: "OK",
                name: "Oklahoma",
                style: "Okla."
            }, {
                abbr: "OR",
                name: "Oregon",
                style: "Ore."
            }, {
                abbr: "PA",
                name: "Pennsylvania",
                style: "Pa."
            }, {
                abbr: "RI",
                name: "Rhode Island",
                style: "R.I."
            }, {
                abbr: "SC",
                name: "South Carolina",
                style: "S.C."
            }, {
                abbr: "SD",
                name: "South Dakota",
                style: "S.D."
            }, {
                abbr: "TN",
                name: "Tennessee",
                style: "Tenn."
            }, {
                abbr: "TX",
                name: "Texas",
                style: "Tex."
            }, {
                abbr: "UT",
                name: "Utah",
                style: "Utah"
            }, {
                abbr: "VA",
                name: "Virginia",
                style: "Va."
            }, {
                abbr: "VT",
                name: "Vermont",
                style: "Vt."
            }, {
                abbr: "WA",
                name: "Washington",
                style: "Wash."
            }, {
                abbr: "WI",
                name: "Wisconsin",
                style: "Wis."
            }, {
                abbr: "WV",
                name: "West Virginia",
                style: "W.Va."
            }, {
                abbr: "WY",
                name: "Wyoming",
                style: "Wyo."
            }
        ],
        init: function () {
            return this;
        },
        parseYYYYMMDDString: function (dstr) {
            return new Date(parseInt(dstr.substr(0, 4), 10), parseInt(dstr.substr(4, 2), 10) - 1, parseInt(dstr.substr(6, 2), 10));
        },
        getDateString: function (d, abbrMonth, incTime, incAmPm, upper) {
            var mo = (abbrMonth) ? this.MONTHS_ABBR[d.getMonth()] : this.MONTHS[d.getMonth()];
            if (upper) mo = mo.toUpperCase();
            var str = mo + " " + d.getDate() + ", " + d.getFullYear();
            if (incTime) {
                str += " " + this.getTimeString(d, incAmPm, upper);
            }
            return str;
        },
        getTimeString: function (d, incAmPm, upper) {
            if (incAmPm !== false) incAmPm = true;
            var hrs = d.getHours() % 12;
            if (hrs == 0) hrs = 12;
            var ampm = (upper) ? ((d.getHours() >= 12) ? " PM" : " AM") : ((d.getHours() >= 12) ? " p.m." : " a.m.");
            return hrs + ":" + ((d.getMinutes() < 10) ? "0" + d.getMinutes() : d.getMinutes()) + ((incAmPm) ? ampm : "");
        }
    }).init();
}
if (typeof NYTMM != 'undefined' && typeof NYTMM.ThreadedComments == 'undefined') {
    NYTMM.ThreadedComment = Class.create({
        initialize: function (parentComment, data) {
            this.apiBase;
            this.cachedBase;
            this.topicId;
            this.id = (data) ? data.id : null;
            this.parent = parentComment
            this.replies = [];
            this.pageNum = 0;
            this.numPages = 0;
            this.loadingReplies = false;
            this.repliesRequest
            this.layout = NYTMM.createElement("li", "", "nytmm_threadedComment clearfix");
            if (data) {
                this.postInfo = this.layout.appendChild(NYTMM.createElement("div", "", "postInfo"));
                var pd = new Date(data.approved_at);
                this.userName = this.postInfo.appendChild(NYTMM.createElement("h5", data.display_name, "userName"));
                this.userLocation = this.postInfo.appendChild(NYTMM.createElement("h6", data.location, "userLocation"));
                this.postDate = this.postInfo.appendChild(NYTMM.createElement("h6", NYTMM.TimesStyle.getDateString(pd, true, true, true, true, true), "postDate"));
                this.body = this.layout.appendChild(NYTMM.createElement("p", data.body, "body"));
            }
            this.repliesList = this.layout.appendChild(NYTMM.createElement("ul", "", "nytmm_threadedComment_replies"));
            this.nextPageButton = NYTMM.createElement("li", "Load More Comments", "nextPageButton");
            this.nextPageButton.observe("click", this.loadMoreReplies.bind(this));
        },
        loadMoreReplies: function () {
            if (this.loadingReplies) return;
            if (!this.apiBase || !this.cachedBase || !this.topicId) {
                try {
                    console.log("NYTMM.ThreadedComments::ERROR - You must specify an apiBase, a cachedBase, and a topicId.");
                } catch (e) {}
                return;
            }
            if (!this.apiBase.match(/$\//)) this.apiBase = this.apiBase + "/";
            if (!this.cachedBase.match(/$\//)) this.cachedBase = this.cachedBase + "/";
            var url
            if (this.parent == null) {
                if (this.numPages == 0) {
                    url = this.cachedBase + "topic_" + this.topicId + ".js";
                } else if (this.pageNum > 0) {
                    url = this.apiBase + "topics/" + this.topicId + "/page/" + this.pageNum + ".js";
                } else return;
            } else {
                if (this.numPages == 0) {
                    url = this.apiBase + "comments/" + this.parent.id + ".js";
                } else if (this.pageNum > 0) {
                    url = this.apiBase + "comments/" + this.parent.id + "/page/" + this.pageNum + ".js";
                } else return;
            }
            this.repliesRequest = new Ajax.Request(url, {
                method: 'get',
                onSuccess: this.onRepliesResponse.bind(this),
                onFailure: this.onRepliesResponse.bind(this, null)
            });
            this.loadingReplies = true;
        },
        onRepliesResponse: function (r) {
            this.loadingReplies = false
            if (!r) {
                return;
            }
            var data = r.responseText.evalJSON(true);
            var cdata = {
                comments: []
            };
            if (this.parent == null) {
                if (this.numPages == 0) {
                    this.numPages = data.children.total_pages;
                    this.pageNum = this.numPages;
                    cdata = r.children;
                } else if (this.pageNum < this.numPages) {
                    cdata = data;
                } else return;
            } else {
                if (this.numPages == 0) {
                    this.numPages = data.children.total_pages;
                    this.pageNum = this.numPages;
                }
                cdata = r.children;
            }
            for (var i = 0; i < cdata.comments.length; i++) {
                this.addReply(cdata.comments[i]);
            }
            this.pageNum--;
            if (this.pageNum > 0) {
                this.repliesList.appendChild(this.nextPageButton);
            } else {
                this.repliesList.removeChild(this.nextPageButton);
            }
        },
        addReply: function (r, i) {
            var tc = new NYTMM.ThreadedComment(this, r);
            tc.apiBase = this.apiBase;
            tc.cachedBase = this.cachedBase;
            tc.topicId = this.topicId;
            if (i != null && i >= 0 && i < this.replies.length) {
                this.replies.splice(i, 0, tc);
                this.repliesList.insertBefore(tc.layout, this.layout.childNodes[i]);
            } else {
                this.replies.push(tc);
                this.repliesList.appendChild(tc.layout);
            }
        }
    });
    NYTMM.ThreadedComments = Class.create(NYTMM.ThreadedComment, {
        initialize: function ($super, parentElement) {
            $super(null, null)
            this.layout = NYTMM.createElement("div", "", "nytmm_threadedComment nytmm_threadedComments");
            if (parentElement) parentElement.appendChild(this.layout);
            this.kicker = this.layout.appendChild(NYTMM.createElement("h6", "", "kicker"));
            this.head = this.layout.appendChild(NYTMM.createElement("h4", "", "topicHead"));
            this.intro = this.layout.appendChild(NYTMM.createElement("p", "", "topicIntro"));
            this.layout.appendChild(this.repliesList);
        },
        loadTopic: function (t) {
            this.topicId = t;
            this.replies = [];
            this.pageNum = 0;
            this.numPages = 0;
            this.repliesList.innerHTML = "";
            this.loadComments();
        },
        loadComments: function () {
            this.loadMoreComments();
        },
        loadMoreComments: function () {
            this.loadMoreReplies();
        },
        onRepliesResponse: function ($super, r) {
            var firstPage = (this.numPages == 0);
            $super(r);
            if (firstPage) {
                var data = r.responseText.evalJSON(true)
                this.kicker.innerHTML = data.kicker;
                this.head.innerHTML = data.title;
                this.intro.innerHTML = data.intro;
                if (this.kicker.innerHTML == "") this.kicker.hide();
                else this.kicker.show();
                if (this.head.innerHTML == "") this.head.hide();
                else this.head.show();
                if (this.intro.innerHTML == "") this.intro.hide();
                else this.intro.show();
            }
        }
    });
    NYTMM.ThreadedCommentForm = Class.create({
        initialize: function (parentComment) {}
    });
}
NYTMM.ComingOut.StoryScreen = Class.create({
    initialize: function () {
        this.story;
        this.active = false
        this.layout = NYTMM.createElement("div", "", "nytmm_comingOut_storyScreen")
        this.storyHeader = this.layout.appendChild(NYTMM.createElement('div', '', 'storyHeader clearfix'));
        var homeButton = this.storyHeader.appendChild(NYTMM.createElement('div', "&laquo; Back to 'Coming Out'", 'homeButton'));
        var nextButton = this.storyHeader.appendChild(NYTMM.createElement('div', 'Next&nbsp;Story&nbsp;<span>&#9654;</span>', 'nextButton'));
        var prevButton = this.storyHeader.appendChild(NYTMM.createElement('div', '<span>&nbsp;</span>&nbsp;Previous&nbsp;Story', 'prevButton'));
        homeButton.observe('click', function () {
            var s = this.story;
            if (s) {
                if (s.type == NYTMM.ComingOut.STORY_TYPES.NYT) {
                    NYTMM.ComingOut.app.showMenu();
                } else {
                    NYTMM.ComingOut.app.showReaderStories();
                }
            } else {
                NYTMM.ComingOut.app.showMenu();
            }
        }.bind(this));
        prevButton.observe('click', function () {
            NYTMM.ComingOut.app.prevStory()
        });
        nextButton.observe('click', function () {
            NYTMM.ComingOut.app.nextStory()
        })
        this.main = this.layout.appendChild(NYTMM.createElement("div", "", "storyMain"))
        this.kicker = this.main.appendChild(NYTMM.createElement("h6", "", "kicker"));
        this.head = this.main.appendChild(NYTMM.createElement("h1", ""));
        this.intro = this.main.appendChild(NYTMM.createElement("p", "", "intro"))
        this.nytStoryContent = this.main.appendChild(NYTMM.createElement("div", "", "nytStoryContent"))
        this.videoContainer = this.nytStoryContent.appendChild(NYTMM.createElement("div", "", "videoContainer"));
        this.videoPadding = this.nytStoryContent.appendChild(NYTMM.createElement("div", "", "videoPadding"))
        this.videoPlayer = new NYTMM.VideoPlayer(this.videoContainer, 930, 620, null, {
            skin: "dark",
            controlsBelow: false,
            autoRewind: false,
            autoPlay: true
        })
        this.endVideoScreen = this.videoContainer.appendChild(NYTMM.createElement("div", "", "endVideoScreen"));
        var tr = this.endVideoScreen.appendChild(NYTMM.createElement("div", "", "row topRow"));
        this.outro = tr.appendChild(NYTMM.createElement("p", "", "outroText"));
        var br = this.endVideoScreen.appendChild(NYTMM.createElement("div", "", "row bottomRow"));
        br.appendChild(NYTMM.createElement("div", "", "replayButton")).observe("click", this.onReplayClick.bind(this));
        br.appendChild(NYTMM.createElement("div", "", "dividerLine"));
        this.endPrevButton = br.appendChild(NYTMM.createElement("div", "", "endVideoNextPrevButton"));
        this.endPrevButton.observe("click", this.onEndPrevClick.bind(this));
        br.appendChild(NYTMM.createElement("div", "", "dividerLine"));
        this.endNextButton = br.appendChild(NYTMM.createElement("div", "", "endVideoNextPrevButton"));
        this.endNextButton.observe("click", this.onEndNextClick.bind(this));
        this.endVideoScreen.hide()
        this.userStoryContent = this.layout.appendChild(NYTMM.createElement("div", "", "userStoryContent"))
        this.userStoryText = this.userStoryContent.appendChild(NYTMM.createElement("div", "", "userStoryText"))
        this.userVideoPlayer = new NYTMM.VideoPlayer(this.userStoryText, 560, 420, null, {
            skin: "dark",
            controlsBelow: false
        });
        this.userVideoPlayer.flashPlayerVars.showOverlay = false;
        this.userVideoPlayer.layout.hide();
        this.userStoryText.appendChild(NYTMM.createElement("div", "â€œ", "quoteMark right"));
        this.userStoryText.appendChild(NYTMM.createElement("div", "â€", "quoteMark left"));
        this.userStoryTextBody = this.userStoryText.appendChild(NYTMM.createElement("div", "", "userStoryTextBody"));
        this.userStoryInfo = this.userStoryContent.appendChild(NYTMM.createElement("div", "", "userStoryInfo"))
        //		this.commentsHead = this.layout.appendChild(NYTMM.createElement("h3","Reader Comments","commentsHead"))
        //		this.commentList.apiBase = "http://projects.nytimes.com/bento-box/api/"
        document.observe(NYTMM.VideoPlayer.END_EVENT, this.onVideoEnd.bind(this));
        document.observe(NYTMM.VideoPlayer.PAUSE_EVENT, this.onVideoPause.bind(this));
        document.observe(NYTMM.VideoPlayer.PLAY_EVENT, this.onVideoPlay.bind(this));
    },
    showComment: function (index) {
        NYTMM.log("show comment: " + index);
        var commentDivs = $$('.nytmm-comments');
        if (!commentDivs) return
        for (var i = 0; i < commentDivs.length; i++) {
            var comment = commentDivs[i];
            if (i == index) {
                comment.style.display = "block";
            } else {
                comment.style.display = "none";
            }
        }
        if (index == -1) {}
    },
    hideComment: function () {
        this.showComment(null);
    },
    onVideoEnd: function (e) {
        this.endVideoScreen.show();
    },
    onVideoPause: function (e) {
        if (e.memo.target != this.videoPlayer) return
    },
    onVideoPlay: function (e) {
        if (e.memo.target != this.videoPlayer) return
            //		if (NYTMM.browser == NYTMM.Browsers.IE && NYTMM.browserVersion < 7.5) {
            //		}
            //			NYTMM.LightBox.open(null)
        this.endVideoScreen.hide();
    },
    onReplayClick: function () {
        this.videoPlayer.play();
    },
    onEndPrevClick: function () {
        if (NYTMM.ComingOut.app.getPrevStory()) NYTMM.ComingOut.app.prevStory();
    },
    onEndNextClick: function () {
        var ns = NYTMM.ComingOut.app.getNextStory();
        if (ns) {
            if (ns.type == NYTMM.ComingOut.STORY_TYPES.NYT) {
                NYTMM.ComingOut.app.nextStory();
            } else {
                NYTMM.ComingOut.app.showReaderStories();
            }
        } else {
            NYTMM.ComingOut.app.showMenu();
        }
    },
    setActive: function (a) {
        this.active = a;
        if (a) {
            window.scroll(0, 0);
        } else {
            this.setStory(null)
        }
    },
    setStory: function (s) {
        NYTMM.log('setStory: ' + s);
        this.story = s;
        this.userVideoPlayer.layout.hide();
        this.nytStoryContent.hide();
        this.userStoryContent.hide();
        this.endVideoScreen.hide();
        if (!this.story) {
            this.head.innerHTML = "";
            this.intro.innerHTML = "";
            this.outro.innerHTML = "";
            this.videoPlayer.setSource("");
            return;
        }
        if (this.story.type == NYTMM.ComingOut.STORY_TYPES.NYT) {
            this.kicker.innerHTML = "";
            this.head.innerHTML = this.story.title;
            this.intro.innerHTML = this.story.intro;
            this.outro.innerHTML = this.story.outro
            var ns = NYTMM.ComingOut.app.getNextStory();
            var ps = NYTMM.ComingOut.app.getPrevStory();
            if (ns && ns.type == NYTMM.ComingOut.STORY_TYPES.NYT) {
                this.endNextButton.innerHTML = "<h6>Next Story</h6>" + ns.title;
                this.endNextButton.removeClassName("disabled");
            } else {
                this.endNextButton.innerHTML = "<h6>Next</h6>Readers' Stories";
                this.endNextButton.removeClassName("disabled");
            }
            if (ps) {
                this.endPrevButton.innerHTML = "<h6>Previous Story</h6>" + ps.title;
                this.endPrevButton.removeClassName("disabled");
            } else {
                this.endPrevButton.innerHTML = "";
                this.endPrevButton.addClassName("disabled");
            }
            this.nytStoryContent.show();
            NYTMM.log('setting video: ' + s.video);
            this.videoPlayer.setSource(s.video)
            this.showComment(this.story.topicId);
        } else if (this.story.type == NYTMM.ComingOut.STORY_TYPES.USER) {
            this.kicker.innerHTML = "Reader-Submitted Story";
            this.head.innerHTML = this.story.title;
            this.intro.innerHTML = "";
            this.outro.innerHTML = ""
            this.userStoryContent.show();
            var txt = NYTMM.Strings.toHTML(this.story.text);
            txt = txt.replace(/^(\w)/, "<span class=\"firstLetter\">$1</span>");
            this.userStoryTextBody.innerHTML = txt;
            var infoHTML = "<h5>" + this.story.name + "</h5>";
            if (this.story.age && this.story.age != "") infoHTML += "<h6>" + this.story.age + " years old</h6>";
            if (this.story.location && this.story.location != "") infoHTML += "<h6>" + this.story.location + "</h6>";
            this.userStoryInfo.innerHTML = infoHTML
            if (this.story.youTubeVideoId != null) {
                this.userVideoPlayer.layout.show();
                this.userVideoPlayer.setSource(this.story.youTubeVideoId);
            }
            this.showComment(-1)
        }
    },
    getStory: function () {
        return this.story;
    }
});
NYTMM.ComingOut.TopMenu = Class.create({
    initialize: function () {
        this.offsetTop = 1000000
        this.state = "";
        this.noFixedPosition = false;
        this.scrollEnabled = true
        if (NYTMM.platform == NYTMM.Platforms.IPAD || NYTMM.platform == NYTMM.Platforms.IPAD) this.noFixedPosition = true;
        else if (NYTMM.browser == NYTMM.Browsers.IE && NYTMM.browserVersion < 7.0) this.noFixedPosition = true
        this.layout = NYTMM.createElement("div", "", "nytmm_comingOut_topMenu")
        this.menuButton = this.layout.appendChild(NYTMM.ButtonFactory.notchedButton("Main Menu", "#666666", 3, 6));
        this.submitStoryButton = this.layout.appendChild(NYTMM.ButtonFactory.notchedButton("Tell Us Your Story", "#666666", 3, 6));
        this.menuButton.addClassName("menuButton");
        this.submitStoryButton.addClassName("submitStoryButton")
        this.upDownButtons = this.layout.appendChild(NYTMM.createElement("div", "", "upDownButtons"));
        this.upButton = this.upDownButtons.appendChild(NYTMM.ButtonFactory.notchedButton("http://graphics8.nytimes.com/images/multimedia/arrow_up_small_white.gif", "#666666", 0));
        this.downButton = this.upDownButtons.appendChild(NYTMM.ButtonFactory.notchedButton("http://graphics8.nytimes.com/images/multimedia/arrow_down_small_white.gif", "#666666", 0));
        this.upButton.addClassName("upButton");
        this.downButton.addClassName("downButton");
        this.menuButton.observe("click", this.onMenuClick.bind(this));
        this.submitStoryButton.observe("click", this.onSubmitStoryClick.bind(this));
        this.upButton.observe("click", this.onPrevClick.bind(this));
        this.downButton.observe("click", this.onNextClick.bind(this));
        Event.observe(window, "scroll", this.onWindowScroll.bind(this));
    },
    onMenuClick: function () {
        NYTMM.ComingOut.app.showMenu();
    },
    onSubmitStoryClick: function () {
        window.open(NYTMM.ComingOut.stuffyFormURL, "submissionForm");
    },
    onNextClick: function () {
        NYTMM.ComingOut.app.nextStory();
    },
    onPrevClick: function () {
        NYTMM.ComingOut.app.prevStory();
    },
    onWindowScroll: function () {
        var st = document.viewport.getScrollOffsets().top;
        if (this.scrollEnabled && st > this.offsetTop) {
            if (this.noFixedPosition) {
                this.layout.style.position = "absolute";
                this.layout.style.top = st - this.offsetTop + "px";
            } else {
                if (this.layout.style.position != "fixed") {
                    this.layout.style.position = "fixed";
                    this.layout.style.top = "0";
                }
            }
        } else {
            this.layout.style.position = "absolute";
            this.layout.style.top = "0"
        }
    },
    setState: function (s) {
        s = (s) ? s.toLowerCase() : "";
        if (this.state == s) return
        if (this.state == NYTMM.ComingOut.STATES.MENU) {} else if (this.state == NYTMM.ComingOut.STATES.STORY) {}
        this.state = s;
        if (this.state == NYTMM.ComingOut.STATES.MENU) {
            this.menuButton.hide();
            this.upDownButtons.show();
            this.scrollEnabled = true;
        } else if (this.state == NYTMM.ComingOut.STATES.STORY) {
            this.menuButton.show();
            this.upDownButtons.hide();
            this.scrollEnabled = false;
        }
    },
    updateOffsetTop: function () {
        try {
            this.offsetTop = $("interactiveFreeFormMain").cumulativeOffset().top;
        } catch (e) {
            this.offsetTop = 1000000;
        }
    }
});
NYTMM.DebugLevel = 1;
NYTMM.ComingOut.Application = Class.create({
    initialize: function (parent, data) {
        parent.update();
        NYTMM.ComingOut.app = this
        this.data = data;
        this.stories = data.stories;
        this.userStories = [];
        this.allStories = []
        this.state = "";
        this.storyIndex = -1
        for (var i = 0; i < this.stories.length; i++) {
            var s = this.stories[i];
            if (s.visible == false) {
                this.stories.splice(i, 1);
                i--;
                continue;
            }
            s.id = NYTMM.Strings.toId(s.name);
            s.type = NYTMM.ComingOut.STORY_TYPES.NYT;
            s.quote = NYTMM.Strings.toHTML(s.quote);
            this.allStories.push(s);
        }
        this.layout = parent.appendChild(NYTMM.createElement("div", "", "nytmm_comingOut"))
        this.topHeader = this.layout.appendChild(NYTMM.createElement('div', '', 'nytmm-topHeader clearfix'))
        //		submitStoryButton.addClassName('submitStoryButton');
        var fbButton = this.topHeader.appendChild(NYTMM.createElement('div', "FACEBOOK", "fbDark"));
        var twitButton = this.topHeader.appendChild(NYTMM.createElement('div', "TWITTER", "twitDark"))
        fbButton.observe('click', this.onFBClick.bind(this));
        twitButton.observe('click', this.onTwitClick.bind(this))
        this.topMenu = new NYTMM.ComingOut.TopMenu()
        // this.topMenu.updateOffsetTop()
        this.storyMenu = new NYTMM.ComingOut.StoryMenu(this.stories)
        this.storyScreen = new NYTMM.ComingOut.StoryScreen();
        NYTMM.log("Calling Ajax " + NYTMM.ComingOut.userSubmissionDataURL)
        new Ajax.Request(NYTMM.ComingOut.userSubmissionDataURL, {
            method: 'get',
            onSuccess: this.onUserStoriesLoad.bind(this)
        });
        document.observe(NYTMM.ComingOut.MenuItem.PLAY_EVENT, this.onStoryPlay.bind(this));
        document.observe(NYTMM.LocationHash.CHANGE_EVENT, this.onHashChange.bind(this));
        NYTMM.LocationHash.checkInitialHash()
    },
    onUserStoriesLoad: function (result) {
        NYTMM.log("User Stories Loaded " + result)
        if (!result || !result.responseText) return;
        var data = result.responseText.evalJSON()
        //		var data = {"pagination":{"per_page":500,"page":1,"total":11},"submissions":[{"submission":{"name":"Charlie Schenck","created_at":"2011-05-13T06:00:00Z","location":"Weston, W. Va.","you_tube_video":"","images":[],"project_id":"4d94ab6d5556a36e69000001","story_title":"\"I decided at about age 9 or 10, that I was going to fake being straight for the rest of my life..\"","written_story":"My name is Charlie, I am currently 16, and I knew I was gay when I was 5.\n\nWhen most people hear me say that, they ask, \"You were thinking about sex when you were 5?\"\n\nOf course I wasn't. I thought certain boys in my class were cute. I liked them, it's as  simple as that. By that point, I had been taught that being gay was wrong. The church told me God hates gays, and that they're truly unholy. So I hated myself. At age 6, I was absolutely terrified that I was going to go to hell because I was gay. I was afraid to get too close to other boys growing up, and I was afraid to like things such as musicals or show tunes. I was afraid that someone would accuse me of being gay, and I would be completely ostracized.\n\nWhen I was 9, I contemplated suicide. I was almost certain that God had made a mistake and that I was wrong. Every night, I would pray to God that I would be straight, and that he would love me. That prayer never came true, and I thought God was ignoring me. I kept thinking about never being able to go to anyone about this, and just feeling completely alone. I kept asking myself, \"What are you going to do when you get older?\" So, I decided at about age 9 or 10, that I was going to fake being straight for the rest of my life, and I'm going to grow old and die alone. So I started getting used to the idea of living alone.\n\nAt about age 11, my family moved to a tiny town in West Virginia called Weston. Weston is a miniscule town nestled in the mountains with a population of 4,317 people (according to the 2000 census). The town's key icon is a closed insane asylum, if that tells you anything.  Everything was fine for the most part, until I reached high school four years later.\n\nBy then, I'd already had several girlfriends. I had lied to all of them, and I even went so far to tell them I loved them, because I wanted to believe it was true. I still hated myself, and besides from my best friend, I stayed distant from most people. I had acquaintances, but I couldn't talk to them about anything serious. Every night I prayed, and every morning I woke up disappointed. I met my best friend Nolan in sixth grade in math class, and he became like a brother to me. We spent literally every weekend at each other\u2019s house. I really trusted him, but I still couldn't bring myself to tell anyone else about my sexuality.\n\nDuring my freshman year at high school, I met a whole plethora of new friends. I found out that I wasn't the only gay person in this town (Yes, for a while, I really thought I was the only one). Having so many accepting people around me really contributed to me coming to terms with who I was. It made me feel a bit more comfortable in my own skin, but that feeling ended when the harassment began. One day, I had just finished up an exam, and I was walking back to my classroom. There were two guys at the end of the hallway, glancing my way then laughing. When I got close enough, they said, \"Hey, sweetie,\" in a very stereotypical gay voice and then continued, suggesting sexual acts I can't repeat.   As I walked away, they called me by a slur and then kept repeating it. So I started feeling insecure again. I started feeling like I was a mistake. A few weeks later, I was sitting at the lunch table with my friends, when someone threw a piece of bread at me. I looked around, and this girl got up, and starting throwing food at me. All her friends around her were laughing as she called me that name again. They eventually got up and left, but one girl came back and threw a spoon full of mashed potatoes at me. I still have no idea why she did that, but again, I felt insecure. I reported the incidents, but the only thing that came of it was me being called to the counselor's office to talk about it.\n\nFreshman year was rough, but soon I became a sophomore. That's the year I discovered the \"It Gets Better\" project. I watched dozens of videos for days. So one Thursday morning, I was just sitting in biology, and I suddenly wanted to \"come out,\" as it's referred to. I just felt so ... excited! At first, I told myself I would come out Monday, but then I thought, \"Why wait? I'll do it today.\" So I decided to tell my creative writing class. The people in my creative writing class became as close as family as the year went on, and I thought I could trust them. So for the next two periods, I was literally shaking with anticipation. In creative writing, we sometimes do \"spark words,\" which is when we choose a topic, and then just write about it. So I went up to my teacher, and requested that today's spark word be \"Dark Secrets.\" Looking back, my handwriting was just AWFUL, because I was shaking so much. And this is what I wrote, and then read to the class:\n                         \"I don't know if what I'm about to do is really brave, or really dumb. I've wanted to do this all day, but my heart is pounding, and I'm terrified. I have a confession to make, and I've been hiding it for about seven or eight years now. I just have to trust everyone ... Okay, this is the biggest step of my life, and you all are about to be the first to hear it. I'm gay. Some of you may have suspected it, but I want you to know I'm still the same person. I still hate 'Twilight,' and I still believe 'Twilight's' cast and Justin Bieber can go die in a domestic fire. If you guys hate me, I'm really sorry to hear it because I really could use some friends right now. I'm tired of lying, and I feel getting this off my chest will take a few links out of the chain that binds me down.\"\n \nAt this point, I bury my face in my books, and start crying. I didn't know what to expect at all, but pretty soon, my entire class got up, hugged me, and said, \"We love you so much!\"\n\nAnd the rest was history. That day, I got home, told my family, and they were all fine with it. Even my grandparents. If anything, my friends loved me more, and my mom's relationship with me grew stronger. I was so happy, I didn't know what to do with myself. I mean, what can you do with yourself when the day you think will never come finally comes? I've become so much happier, and so much more secure with myself since I finally worked up the courage to say what I said. I still get harassed, and I've even been threatened to be hanged, but me coming to terms with who I was meant that it's not my problem. If you don't like it, than it's your problem. I hear the words \"faggot\" and \"queer\" on a daily basis, but I wouldn't have changed my mind for anything. I've joined a church that accepts everyone, I'm a very religious boy, and I even have a date with someone. Being a teenager sucks, but accepting myself seemed to brighten the spectrum. I can honestly say without a doubt, it does get better. \n","id":"4dbb2e9fdf72484be100002b","location_latlng":null,"age":"16"}},{"submission":{"name":"Corey L. Johnson","created_at":"2011-05-13T05:30:00Z","location":"Scottsboro, Ala.","you_tube_video":"","images":[],"project_id":"4d94ab6d5556a36e69000001","story_title":"\"Praying would cure me.\"","written_story":"I believe I was in elementary school when I learned that I wasn\u2019t the perfect-looking child, if I can remember back that far. ... The left-handed kid, the kid that could draw, the kid that didn\u2019t have friends, the kid that was fat. All of those were I. \n\nMy name is Corey Johnson, and I am a young gay American living in the conservative Bible Belt region of northeastern Alabama. My small city has been known in the past as the place of discrimination and prejudice, yet around 2000, the city adopted the logo \u201cThe Friendly City\u201d in an effort to move into the future. That\u2019s bull. Complete bull. The city may be racially equal, but for students of different sexual orientations, it has not happened yet.\n\nIn sixth grade, I became aware that I didn\u2019t click with girls. I did, however, like boys. My mind entertained the notion that me liking boys would be a phase, that everyone had to go through, and that it would be over soon enough. \n\nI will tell you right now, that did not happen. In junior high, I separated myself from everyone else, thinking I was a freak. I was depressed. I wore black. I was \u201cemo\u201d and quiet. Every day when I came home, I would always hear about same-sex marriage becoming legalized, and how my parents and the rest of the world, including my Pentecostal church, were against it. What did that have to do with me? There was no possible way that I would be gay. It was a phase. Just a phase. Praying would cure me.\n\t\nTherefore, after that didn\u2019t work, I tried to commit suicide. It didn\u2019t work. I was too afraid to try it again, or find help, because word would get out that I was mentally insane, so I stayed silent all through seventh and eighth grade, and a little through ninth grade. When I became a part of the class of 2012, I discovered that, well, there was more variety of people than just preps and the rest.\n\nI found more friends, took drama classes, starred in a small play, wrote more often, and focused on my art. This helped me channel my feelings and emotions out in a positive manner. The bad gunk that built up since sixth grade got out, and room was made to sort out my discombobulated thoughts. \n\t\n\u201cOkay, so Corey likes boys.\u201d I whispered to a friend I trusted enough to tell, using third person. \u201cSo Corey is bisexual.\u201d Tasha smiled and gave me a hug.\n\nWhat a relief! I expected the sky to turn black or the sun blow up! Happily, I looked outside the window of the classroom. It was a calm, sunny spring day in biology. It was a sign.\n\nI went a year living on the bridge. I got through two girlfriends, reporting for the school newspaper, a higher social status, and a lot of Google searches for homosexuality. I had a first kiss with a guy in May, and it was like the earth and the rest of the planets became aligned. That following month, I undertook the coming-out process.\n\nI contacted the Trevor Project. They helped me. I found multitudes of resources for LGBT youth. You need believe that, and I quote Harvey Dent from \"The Dark Knight,\" \u201cthe darkest comes before the dawn.\u201d I have been harassed, bullied, called every derogatory name in the book, and even sent to the office, for being an open gay youth. Nevertheless, there are those who admire me, for being strong, for not letting it get me down, for having the strength to move on. I tell myself I get those traits from my Irish and Cherokee ancestry.\n\nHigh school does not last forever. I have one more full year at Scottsboro High, and then I\u2019m gone. My mom, while driving home from a PFLAG (Parents, Families and Friends of Lesbians and Gays) meeting, told me that I should think of college as a fresh start, as a clean slate to begin anew, as a chance to be the person you\u2019ve always wanted to be because no one knows your past. I have a plan to achieve a master of fine arts degree in film and television from the Savannah College of Art and Design, and work my way westward to Tinsel Town, Movieland, Hollywood USA. There will be a director\u2019s chair with my name on it.\n\nMaybe it\u2019s best that I am optimistic about my future in film. I will be away from the people that have hurt me -- who have made me cry -- and I\u2019ll be doing what I love: telling stories. If I wasn\u2019t so optimistic, I think my suicide attempt back in middle school would have succeeded.\n\nUntil then, I have faith that things will be better in the future, and I\u2019ll do my best to guarantee that until the day I rest my head and my soul drifts away ... it will get better.\n\t\n\n","id":"4da9646bd141b93ec6000012","location_latlng":null,"age":"17"}},{"submission":{"name":"S. Crawford","created_at":"2011-05-13T04:00:00Z","location":"Arizona","you_tube_video":"","images":[],"project_id":"4d94ab6d5556a36e69000001","story_title":"\"I just wanted to fit in.\"","written_story":"I joined soccer three years ago as a high school sophomore just to try something new. I have a knack for picking things up, I couldn\u2019t keep my hands down, so I decided I would play as a goalkeeper. I loved playing soccer and decided I would keep playing. Over the first few months I had adjusted, met new people and become close friends with a few girls. One girl in particular was just gorgeous, she was practically my best friend. I\u2019ll admit, I had a thing for her, though I never said anything. I wanted to fit in and be a part of the team, I didn\u2019t want to make enemies or cause problems. I was there to have fun and distract myself. But it wasn\u2019t always fun and games.\n\t\nLater down the road at an away game a few girls said, \u201cThat\u2019s so gay\u201d -- no big deal, right? I brushed it off and ignored it. It doesn\u2019t help to get bothered over things like that, I suppose. To each his own. I must have scowled or something to draw attention because later on, the subject moved on to me. \n\t\n\u201cDo you have a boyfriend?\u201d they would ask. Of course I had said no. They would always ask, but being who I was I would joke around a little and try to hint at the fact, hey, guys aren\u2019t really my thing. I think eventually they caught on because one day before a game, one of the girls asked point-blank, \u201cAre you a lesbian?\u201d I stuttered trying to think of an answer and just shook my head no. I lied, and I felt like garbage for doing so. \n\t\nI was scared, a little terrified. I was in a girl\u2019s sport with girl teammates, friends that were girls, etcetera, etcetera. I didn\u2019t want to offend anyone, I didn\u2019t want to creep anyone out. I knew there were a few girls on the team with heavy religious affiliations and my preferences would have most likely been met with raging opposition. Why didn\u2019t I come out? Why can\u2019t I be myself? I just wanted to fit in, I guess. I envy people who have the courage to come out and hold an incredible amount of respect for them as well.\n\t\nIn the end, I kept my mouth shut and shook my head. Perhaps a good decision, I had thought at the time, but I regret saying no.  Now, I don\u2019t know what it would have been like to be open, but this is high school after all. I have my whole life ahead of me to be myself, perhaps with more open and welcoming people in the future. \n\t\nNow, as far as school goes, my school is unfortunately not too open as far as LGBT ideas and opinions go. The only way we could get an equality club going was to get it to where it wasn\u2019t specifically designated for LGBT. This club was made three years ago. There are always slurs used, \u201cThat\u2019s so gay,\u201d saying gay like it\u2019s a bad thing. It reminds me of that campaign they had going on a while ago, \u201cHow would you like it if I said, \u2018That\u2019s so jock?\u2019\u201d You probably wouldn\u2019t. I don\u2019t really mind the whole thing, kids will be kids, but ignorance is not an excuse. You could be making someone feel uncomfortable without realizing it. But that\u2019s not the big issue here, unfortunately. \n\t\nNo, the big issue is you can not feel comfortable in the setting I am allowed. I feel confined to my own desk, anything too out of the ordinary would be ridiculed for some reason or another. Being a lesbian would automatically make you that girl that dates every girl she knows, being bi would make you the one who can\u2019t get a date either way and needs better chances, being gay, well, just insert your favorite stereotype, you get the idea. I could go on and on.  High school is a tough place when you live in a closed-minded community like I do. \n\t\nI just wanted to fit in. For the longest time I had always told myself, hey, I like guys! No! I like guys! I had a few disastrous relationships when I was in middle school. I didn\u2019t really understand why it wasn\u2019t working out. I never really liked the people I had dated. No attraction, never wanted to hold hands. Nothing ever went right so they never lasted too long. Then, I met this girl who was a sixth grader at the time. She was really cute and I liked hanging out with her. At that time, I realized that I wasn\u2019t attracted to guys at all, and if it was any sort of attraction it was a friendly one. That girl helped me realize who I was. \n\t\nAt first, I had some issues with it. I didn\u2019t know what to think, what others would think. More or less, I was a bit confused. At first I thought I was bi, sure, I dated guys in the past, I have to like them, right? Eventually over time I realized I didn\u2019t have any real interest in them for a relationship. I had guys ask me out or try to take me to dances but it never went anywhere or I\u2019d blow them off. Over time I\u2019ve grown more used to the fact that I\u2019m different, but I still know I will not be coming out anytime soon. \n\t\nEven at home I have had issues. I asked my dad how he would feel if I didn\u2019t have kids, if I should adopt. Being the fatherly figure he is, he wanted me to carry on our family name and have kids and said he hoped one day I would meet a man that would pay for everything. I got a chuckle out of that. Over the years, his views about the LGBT community have fortunately changed and he is more tolerant, but I still have not told him about my preference. \n\t\nMy mother is a different story. Everyone has their relationship problems, I had my breakdown at a stoplight on the way to the movies. She asked what was wrong, I told her my girlfriend had broken up with me. Her first stance was, \u201cIt\u2019s just a phase,\u201d the next, \u201cIt\u2019s hormones, you don\u2019t know what you want,\u201d finally, the topic was ignored altogether. She wasn\u2019t mad, perhaps disappointed, but she wasn\u2019t against it. I\u2019m not sure if she\u2019s forgotten about it or not, I haven\u2019t brought it up since. It\u2019s been three years. Three years seems to be the magic number for me.\n\t\nEven though my mother was unable to, I came to terms with my orientation when I had finally met someone I really liked. She was a really nice girl with great personality from Washington. We talked online a lot and had quite a bit in common. One day I asked her out, things were great. Unfortunately, it was a long-distance relationship. For me, a long-distance relationship was comfortable, it was mostly private, I didn\u2019t feel awkward because I wasn\u2019t holding hands and being gawked at. The relationship lasted over a year, and helped me finally realize what I wanted and who I was. It may have taken me a while to do so, but I don\u2019t regret a single moment.\n\t\nI\u2019m now in my senior year in high school. I\u2019ve gone from rookie soccer player to signing with an in-state community college, hoping to be their next starting goalkeeper. I\u2019m not out, but those who are my true friends, those who matter, do know the real me. I\u2019m hoping that by telling my story I can help others out there and maybe my friends will read this story and wonder if it\u2019s me. If they ask, I\u2019ll give them an honest answer. \n","id":"4dadf56dd141b971c800001f","location_latlng":null,"age":"17"}},{"submission":{"name":"Nowmee S.","created_at":"2011-05-13T02:10:00Z","location":"Georgia","you_tube_video":"","images":[],"project_id":"4d94ab6d5556a36e69000001","story_title":"\"There is not even a word for queer or lesbian in my native language...\"","written_story":"Sophomore year was coming to an end, and I had survived my first year in an American high school. I had just moved to the U.S. from halfway across the globe and as I was finally getting over homesickness and settling in to my new life, I was realizing something about myself that I did not like. Something I did not understand completely and could not identify anyone to talk to about. Being gay was ostracized in my religion, I had never seen an LGBT person from my culture, and in fact I had never met an LGBT person of color!  \n\nTwo years ago on a seemingly normal Monday, someone at lunch had mentioned that there was a Gay-Straight Alliance forming in our school and that they were having their first meeting that Friday. I made a quick joke about it and changed the subject. However as the week progressed I found the courage to tell my brother that I was thinking of going to the GSA meeting. Without question he said that he would accompany me. Soon Friday had arrived; it took all the courage I had to walk into that first meeting. As I walked in I saw familiar faces: my classmates, my brother, a teacher I had seen around campus. I was welcomed with a smile and offered snacks. \n\nThat Friday I did not come out of the closet, in fact I was far from even coming out to myself. However that Friday, in Room 119, I had come out as an ally to LGBT youth. It was a big step, considering that I had never said the word \"gay\" out loud, never talked about being gay, that I grew up in a country where being gay is a crime punishable by death. \n\nI am Nowmee, femme, recent immigrant to the U.S., coming from a South Asian, Muslim family. For me those identities never coincided; the tenets of my culture could never let me be both at the same time. There is not even a word for queer or lesbian in my native language and thinking that I somehow don\u2019t have an identity in my culture is scary. \n\nAs I journey through my coming-out process I am struggling to find grounding in my community and it feels like I am living two lives. At school I am out and proud and wear my title as president of the Gay-Straight Alliance with honor; however, each trip home seems like a walk back to the \"closet.\" But this is my reality for now. Today I am a committed LGBT youth activist and have found agency through advocacy at the local and national level. And as I look back at the journey that brought me here I am amazed, and as I look into the future I am hopeful.","id":"4da250918e31df624e00000f","location_latlng":null,"age":"19"}},{"submission":{"name":"David Prince","created_at":"2011-05-13T02:00:00Z","location":"Clawson, Mich.","you_tube_video":"","images":[],"project_id":"4d94ab6d5556a36e69000001","story_title":"\"I had fallen from grace into my own hands...\"","written_story":"Everything was perfect. I had a married mother and father, a younger brother, a paid-off house, a middle-class life, a strong Mormon lifestyle that our family practiced. At my young age I could have never imagined anything different. My father was an elder in the Mormon Church and my mother was involved with the primary. I always attended services, Sunday school and other meetings within the three-hour Sunday services. I grew close to God, and I felt Him growing closer to me. I saw in front of me a bright future, which I\u2019m sure every young LDS boy does, which involved going through the temple and going on a two-year mission to preach the gospel and eventually getting married to a beautiful wife for time and all eternity. Everything was perfect, until a knock at the door changed my entire life.\n\nAs perfect as life seemed from the outside, even from the inside, something seemed slightly different. From as early as I can remember I had never had an attraction toward girls. As puberty hit, I figured my attraction toward guys was just a phase, but as seventh grade hit things changed. My attractions weren\u2019t going away, I knew they were unholy, I knew it was wrong, but whatever I did, I felt I couldn\u2019t change. I felt trapped. I felt like there was no one that I could turn to. I feared telling anyone out of persecution and I feared telling my parents out of fear of being disowned. So to find someone who had either gone through what I was going through, or to find someone in the same situation as me, I turned to social networking and set up two Myspace accounts, one for my \u201cstraight\u201d Mormon self and one for my \u201cgay\u201d self.  I didn\u2019t want to hook up or anything, but wanted to know how to get through this and make some friends that were gay. At this point in my life, I didn\u2019t really think that gay people existed. They seemed more mythological to me than real. But as time went by on my Myspace, I made a lot of friends that I didn\u2019t know, most of who were gay. \n\nAnd then came the knock.\n\nWe opened the door, and the detectives asked to come in. As soon as we let them in, they took me up to my room. I was terrified. I had no clue what was going on. I later found out when they questioned me that one of the friends who I was talking to online was a pedophile and another one was a New Hampshire police officer. The pedophile was caught and I was caught right in the middle of the whole thing. My computer was confiscated and the police told my parents about my online activities. My sexual orientation was no longer a secret. From my room I heard my mom cry uncontrollably, which brought me so much pain, which I can still feel today. The police left, and with them left the happiness and sound. For months, the house was practically silent. My parents had stopped talking to me. Depression began to settle in deep, and I was enrolled in Church Family Services for depression therapy, but after two sessions, depression therapy turned into conversion therapy. \n\nMy counselor told me that at my age I had a 100 percent chance of overcoming my \u201csame-sex attraction.\u201d This new revelation filled me with hope at again being in favor with God and family, to be able to live the life I had always wanted. I felt hope initially but as months turned into years, and there had been no change, my hope began to dwindle, and the hope that was initially there turned into despair. The program, which I devoted everything to, led me to begin to hate myself. Suicidal ideations filled my mind, and one Sunday I attempted but was halted by my mother and bishop.\n\nLife had turned into a living hell. I kept going to church, and life only got darker.\nThe upward stroke was when I actually met another gay guy who was my age and we dated. Because of my religious guilt, I ended the relationship fast, but this was the beginning in where I began to question my belief in something that I had always known was true. To find myself in a doubting situation at first terrified me. Never in a thousand years would I have thought it would have come to this. My entire lifestyle, world, existence was on a tipping point. It was around this time things became clear.\n\nIf I stayed with the church, got married and lived a typical Mormon life, not only would I be living a lie, but I would have ended up, without a doubt, killing myself, and that alone would condemn me in the next life. The other option would be to leave the church and live life how I would like to and hopefully die at an old happy age, and for being myself, for being gay, meet the same fate that I would have met if I had stayed with the church. Seeing that I could not have salvation either way, I began to see that I didn\u2019t have to believe. I began to accept myself.\n\nOver a series of months I distanced myself from the church until I stopped going. The darkness that once engulfed me, dragging me deeper with every prayer I prayed was cleared and I saw a new light of hope. Around age 16, I started to publicly come out of the closet. \n\nLeaving the Mormon Church is the hardest thing I have ever had to do, because not only did it bring me to the brink of death, but it separated me from my life, my family, and my friends. I had fallen from grace into my own hands, into a brave new world that I alone have to discover. And the path of discovery looks brighter every day.\n","id":"4da397408e31df526000000f","location_latlng":null,"age":"18"}},{"submission":{"name":"Austin Land","created_at":"2011-05-13T01:00:00Z","location":"Fort Gay, W. Va., and Paulding, Ohio","you_tube_video":"","images":[],"project_id":"4d94ab6d5556a36e69000001","story_title":"\"I was bound to get caught...\"","written_story":"Many teens I\u2019ve encountered fear coming out to their peers more so than their family. I, however, was the complete opposite. I started coming out to my friends in eighth grade, but I had made myself believe that my family would never find out. I believed this to be a simple goal. My parents were divorced and I lived with my mother. I should have known better, for my mother was a very nosy person and had to have her nose in everyone\u2019s business.\n \nIt all went downhill during the middle of my freshman year of high school.  I came home from school and my mom was in my room, sitting on my bed, ready to talk. She asked me, \u201cAustin, is there something you\u2019d like to tell me?\u201d I answered simply, with \u201cNo.\u201d She immediately threw a stack of papers at me and said, \u201cI found these on your e-mail.\u201d They were conversations I had been having with a boy I went to school with. \u201cOh no!\u201d   I thought. \u201cWhat do I do?\u201d So I came up with the most immature answer I could have come up with, \u201cThat\u2019s not from my account.\u201d She obviously didn\u2019t believe me but I stuck to my story, and tried my hardest to convince her she was crazy, or crazier, I should say. She gave me a hypocritical lecture on how it was against our religion, when 1.) She had never taken me to church and 2.) Well ... let\u2019s just say she likes attention from the male. This lecture went on forever. I can remember it like it was yesterday, mostly because it consisted of her bashing my friends because they \u201cwere influencing me.\u201d She told me to turn off the feelings. So to simply make things easier, I played the \u201cstraight\u201d boy at home, but still acted myself when around my friends. \n \nNo more big events happened until the summer before my sophomore year. I had met and started dating this boy from a neighboring county. Once again I thought I could keep it from her, and once again I was wrong. We had dated two weeks. On the start of the second week we had a band show at a county fair. Before we boarded the bus to go home, my assistant director caught us kissing, and I was afraid I would get in trouble. On the bus ride home I had expressed my fear of getting in trouble to him via text. When I got home, Mom had a surprise for me; she wanted to search my phone. Sure enough, she found the text and wigged out. She filed a restraining order against him and enrolled me into a different school because she believed that my friends were influencing me, even when none of them were openly gay, even to me. I was devastated. I was so upset with her I wouldn\u2019t even look at her. I went through the school year hating every second of it. I wasn\u2019t allowed to contact my former friends, and this made me even more depressed. I never tried anything drastic like suicide, but I would be lying if I said it had never crossed my mind. My unhappiness continued through Christmas break. After this point my mother started to trust me again. I was able to talk to my friends again and even visit them. As a result I started to become myself again; I was still forced to go to a school I hated though. However, I got by and lived my life. I eventually got a job, at a local Dairy Queen, and this gave me an opportunity to get away from my mother. My recent reunion with my friends and my new job helped get me through the rest of my sophomore year. The last day of school came around and after my last exam, I \u201cblew that Popsicle stand\u201d and drove off to see my friends, whose school let out two days earlier.\n            \nNow it was summer 2010 and my life was back to normal. I was able to hang out with my new friends, had a great job, and my mother had promised to transfer me back to my old school. On June the 11th I turned 17, and I was excited, my curfew changed, as well as did driving restrictions in my state. I took advantage of this, and no matter how wrong I knew my next move was, I did it anyway. I had contacted my former boyfriend and started to talk to him again. For a few weeks I got by with it, but I was bound to get caught sooner or later (you\u2019d think I\u2019d learn, huh?). On June 26th my life changed drastically. I came home from work and my mother was waiting, once again interested in searching my phone. I was caught; I had just finished talking to a boy and didn\u2019t erase the text. So what did I do? I refused to let her have the phone. However, my mother is a very determined woman, I tried with all my might to keep the phone from her but in the end I was overpowered.\n\nWhat she found she didn\u2019t like, and the next day I was forced to quit my job, which I loved. Later that day I was in a car to meet my dad who lived a state away. My dad didn\u2019t like fact of me being gay, because he was a minister, but he also didn\u2019t like the way my mother went about getting my phone. The ride back to dad\u2019s house wasn\u2019t too awkward, but I was really upset; my life was changing and no one but my mother and my boss were aware of my departure from my old home. When I arrived at my dad\u2019s, he allowed me to call my friends back home and let them know what was going on. I settled in with my dad, but was still scared of what was to come of the new school year, being in a rural community in the Bible Belt. Going to dad's church, which was of the Pentecostal denomination, I saw how unaccepting the people where down there. To them being homosexual is an abomination and should be treated that way. However, I soon started school and realized not everyone was of that opinion, in fact, most everyone accepted me.\n           \nToday, I am almost done with my junior year. I love my new school, my new life, and my family. I will be 18 soon, and my original mindset to move back home when I turned 18 is being challenged by my new life, which I love just as much as my former life. Some may say I have had it rough but I don\u2019t dwell on it. Some may say I shouldn\u2019t have been sneaking around, and disobeying my mother; to some extent I\u2019ll agree with that, but I was too scared to stand up to her and lose my safe haven. It turns out I lost it anyway. My dream is to attend Bowling Green State University, in Bowling Green, Ohio, and major in music. I love playing my French horn, and I am pretty good at it too and I can\u2019t dream of doing anything else with my life. However, by choosing to be homosexual and tasting \u201cthe forbidden fruit\u201d my financial \u201cticket\u201d was taken away. I believe everything will work out and I will accomplish my dreams. In my future, I hope to inspire gay youth and be an example that life ... well, \u201cit gets better.\u201d\n","id":"4da4c4ca8e31df2bb000000f","location_latlng":null,"age":"17"}},{"submission":{"name":"Atiyyah Joseph","created_at":"2011-05-12T11:30:00Z","location":"Culver City, Calif.","you_tube_video":"","images":[],"project_id":"4d94ab6d5556a36e69000001","story_title":"\"I feel truly accepted where I live and call it home.\"","written_story":"Life as a teenage lesbian isn't as hard as it could be for me. I say this in the fact that I was born homosexual in a heterosexual family and they do not treat me horribly as if I have committed a crime, as the strife some other LGBTQ teens face. Born and raised in Culver City, California, I feel truly accepted where I live and call it home. It also helps that there are a lot of others like me in my city, so as to not feel alone and completely different. In addition to an openly safe hometown, I have found pure bliss in one of the clubs at my school: Tolerance. \n\nI have yet to discover why the name of Tolerance club isn't Acceptance instead, though this club is probably the location in school where I feel the most accepted. It dawned on me once that before acceptance, you must first achieve tolerance, and in that sense, I understand the name of the club. Every Friday at lunch, I am joined by my friends and a variety of other students at Culver City High School in this club, where we all come together. It is through this club that we focus our attention on gay movies, music, articles, and engage in thought-provoking discussions about the current \"happenings\" in the gay community.\n\nWhen it comes to how good I have it here in Culver City, I am certainly grateful because I know of countless LGBT people that are not out about their sexuality or they have been mistreated because of their intolerant parents, environment or community. I believe that if someone has the passion to move forward and spread awareness throughout the world, then it will happen in time. I am an example of this, because each generation is different and if I was a teenager in my mom's day, I probably would be one of those students who is bullied for who they are. Granted, things are noticeably better now, though there are still the countless times I hear students using gay slurs in the hallway. This is an obvious problem that needs to be fixed, but I find it not as bad as the teens put out of their homes because of who they are. If we continue to fight homophobia, then the world will be a much better place for LGBT generations to come.","id":"4da9c0898e31df5218000012","location_latlng":null,"age":"16"}},{"submission":{"name":"Manny Trevino","created_at":"2011-05-12T11:00:00Z","location":"Brownsville, Tex.","you_tube_video":"","images":[],"project_id":"4d94ab6d5556a36e69000001","story_title":"\"...I knew I was different at the age of 6.\"","written_story":"Some people discover their sexuality during their teenage years.  Oddly enough, I knew I was different at the age of 6. I began to have feelings for people that were the same gender as me.  At first I thought it was normal, but when I started growing up and got into middle school, I started hearing the word \"gay\" a lot.  At that time I didn't know what the word meant, until finally one day I had the courage to ask my friend.  She finally told me the meaning of gay.  The definition I got was simple.  \"Gay just means a guy liking another guy.\" It was so weird how as soon as I figured out what gay meant I heard it all over the place. I remember my brother calling me gay for no reason.  Apparently calling someone else gay made you cool. If they only knew what the other person felt.  \n    \nEvery time I heard my brother call me gay it would hurt so much, but of course I couldn't react because no one knew at the time that I was gay. I remember thinking to myself, \"When I grow up will people know I'm gay, or will I have to hide myself for the rest of my life?\" When I transferred schools, I saw it as a new beginning. I saw it as an opportunity to start the school with everyone knowing I was gay.  Sadly enough, everyone thought the same way as my brother. During that year, I had made a decision that I was going to hide who I really was for the rest of my life. In seventh grade I started dating a girl named Tabitha. The relationship lasted one year. When I finally hit high school, I realized that my best friend (who I had a huge crush on) was also gay and we decided to start a relationship. During that time I decided to come out of the closet. In ninth grade, I told my friends, one by one, that I was gay.  Why did it take me so long? The answer is plain and simple. I was afraid they wouldn't think of me the same. I was afraid they wouldn't be there for me anymore.  I was wrong.  They reacted with a positive thought of me.\n\nA few months later I told my family.  I felt like that was the worst thing I could have done. For six months, I went through a lot of emotional problems. I got sent to counseling, making my parents think that counseling would \"change\" me. I got left out from family activities such as going to the movies or going to the beach with them. I got told from both, my mom and dad, that I was going to grow up alone and wanting to commit suicide. At first I thought they were right. I felt like I had nothing else to live for but my boyfriend. While my family still didn't accept me, my relationship ended.  Thank the lord I had my friends there to cheer me up, specially my friend Tabitha. \n\nNow as a 17-year-old, I am glad to say and tell anyone that needs to know that I am gay. I am now accepted by my family. At first it may seem like it's the worst thing ever, but just give it time and don't give up and life will get better.  Just hang in there.\n \nAnd for those who've been pushed to the point of hating themselves, just remember, to quote one of my favorite artists, \"You were born this way, baby!\"","id":"4da0e2d8d141b908fa00000c","location_latlng":null,"age":"17"}},{"submission":{"name":"Austin Goheen","created_at":"2011-05-12T09:00:00Z","location":"Butler, Ohio","you_tube_video":"","images":[],"project_id":"4d94ab6d5556a36e69000001","story_title":"\"Now, my mom is a lesbian... but telling her this secret...\"","written_story":"My family always \"thought\" I was gay. When my sister and I were younger I would play with her Barbies and dress in her clothes. The first person I told was my sister's best friend -- she is bi -- and the only LGBT youth I knew at the time. It was in a Myspace message, and she had to swear that she wouldn't tell my sister and she never did. Thank God! \n\nThat was one of the easier coming-out experiences -- the hard part was telling my mom. Now, my mom is a lesbian, she has been with women since I was 5 years old, but telling her this secret I've held in me for so long was the hardest thing I've ever had to do. She took it well, I guess. She gave me a big speech about HIV and how she wants grandchildren; I kind of felt like I was breaking her heart. Even after coming out I was still having troubles with SI (self-injury), I was so ashamed of something most people believe I chose. \n\nAfter a while, I started slowly coming out to my siblings.  Coming out to my sister was easy, my mom did it for me. Ha. Coming out to my brother was the hard part. Growing up we were like normal brothers. When I wasn't playing with Barbies with my sister, I was playing \"cops 'n' robbers\" with my brother. I was terrified that coming out to him would ruin our relationship. He expected it, and knew it was coming, but coming out to him was the scariest. \n\nI never told my grandma myself. I came out to my cousin and word just got around the family that Austin is gay. One of my aunts didn't take lightly to it. She is a conservative Christian and was 100 percent positive that my mom made me this way, not God. This went on for a couple of years and my mom being a lesbian, found a partner, who she married and I consider to be my second mom. My mom's wife, Lynn, wasn't allowed at family functions and it upset me -- I longed for my family to accept it.\n\nEverything changed when my sister ended up in the hospital.  My aunt got to see who Lynn really was, not just some lesbian. The hospital really brought my family back together. My sister had a benefit to help pay for medical bills and whatnot, and after it was over I told my grandma I wanted to talk to her. I told her how proud I was of her and my aunt for changing their mind about Lynn. She cried and went on to give me a hug and tell me that she and my aunt are rather fond of Lynn.  It was one of the happiest moments of my life.\n\nIn seventh grade, when I was 13, I came out to a friend at school. She had a crush on me and I thought it was about time to start letting people know the real me. So I just told her I like boys. Naturally, the next day at school I got asked a million times if I was gay and denied it every time. As time went on, I slowly just started saying yes to that question. What did I have to lose?  I knew my real friends would accept it, and the ones that didn't accept it didn't deserve my friendship anyway. \n\nDr. Seuss said, \"Be who you are and say what you feel, because those who mind don't matter, and those who matter don't mind.\" During the first few months of people asking if I was gay, that was the quote I lived by. Coming out in middle school wasn't the best choice I've ever made, because people tend to be mean. I would walk down the hall, hear people snicker, the occasional derogatory term would come out of a self-righteous jock. I would then go to the bathroom and proceed to cry and beg God to tell why he made me this way. \n\nMy eighth-grade year, I decided to be home-schooled. I needed to get away from all the homophobia of public, hick-town schools. The year I spent cut off from the world really did me good. I went back to school this year, my freshman year. It has gotten a lot better, I have friends that accept me and love me for who I am. I am out to everybody and even my teachers. \n\nMy science teacher has really been there for me. We've talked about me being gay and he accepts it and is very cool about it. We discussed religion and how the Bible describes homosexuality as an abomination.  He is Christian and doesn't believe that you can go to hell solely for being gay. It means a lot to me to have a teacher so accepting. Though, everyone knows, where there's good, there is evil. \n\nA homophobic instance this year that really pops into my mind was when a guy was walking behind yelling that he hates who I am (using a slur) just to try to get to me. I went to the vice principal and tried to have my justice, but he did nothing. I felt betrayed. Another act of homophobia wasn't student-related -- it was my principal sending my friend to the office for an inappropriate shirt.  The shirt read, \"I'm not a lesbian, but my girlfriend is.\" She got a Friday school for a violation of dress code. I looked through the handbook and saw nothing about shirts like that. My friend and I decided to talk to our vice principal.  He put the word lesbian in the same category as guns and drug references.  I will never understand it. \n\nThe most recent thing that happened to me was my sister and I were walking down the sidewalk just minding our own business and someone rolls down their window and yells gay slurs out the window towards me. My sister was livid; she screamed at the car as it sped off and picked up a rock, ready to throw it at those people who get off by yelling derogatory terms out car windows. I just felt, like, why me, why do I have to go through this, what did I do that was so wrong? It hurt but I picked myself up off the ground and put it behind me.\n\nBeing LGBTQ in a small rural community like mine isn't fun. I'm the only completely out male within miles. It feels kind of lonely and scary. I know I will make it through this, through high school, through life. One day I hope to be an advocate and show people that it\u2019s not a disease, it's just a small fraction of what makes up someone.\n      ","id":"4dc222d0df7248156c000087","location_latlng":null,"age":"15"}},{"submission":{"name":"Kenji Tsukamoto","created_at":"2011-05-09T09:00:00Z","location":"Huntsville, Ala.","you_tube_video":"","images":[],"project_id":"4d94ab6d5556a36e69000001","story_title":"\"I was afraid to tell...\"","written_story":"I am a gay teenager living in a traditionally conservative state, Alabama.\n\nAs if it weren\u2019t bad enough that I have had to struggle with bullying and teasing from my peers on a regular basis, I have also had to struggle with coming out to my father. \n\nComing out to my father was made particularly difficult because he comes from a very traditional Japanese upbringing. I had often worried about how I would tell him, or even if there was something wrong with me. When I finally gathered the courage to tell my father that I was gay he reacted like I had feared. He kicked me out of his house. To this day he chooses not to have me in his life, something that has hurt me, but I have learned to live with this fact. After my expulsion from my father\u2019s domicile I moved in with my mother, whom I had not yet told the true reason for my father kicking me out. I was afraid to tell her for fear that she might do like my father had done and more or less disown me. Several months passed and one day while my mother and I were sitting on the sofa, she asked me if I was gay. Hesitant, and filled with fear that she too might kick me out, I told her I was \"bi.\" I knew full well I wasn't bi, but I hoped that my mother would leave it at that. Something inside her must have told her that I wasn\u2019t telling the truth. She told me, \"It's fine if you are. I'll love you no matter what,\" but I chose not to carry on the conversation any further. \n\nFreshman year of high school I began coming out to friends, that's when the bullying started. To this day, in my junior year of high school, I am still being harassed by my peers, some of whom I have never even met. I have told the counselors at the school about it and nothing has been done. I can be in a seemingly neutral location like a mall and I can hear taunts from people I have never even met in my life. Let me take a moment to put something on the records though. While I live in Alabama, I am fortunate to live in Huntsville, a town that seems to be set off from the rest of the state. It seems like there are more accepting people here, even if I do have to run into the occasional Neanderthal. \n\nAfter a while I finally came out to my mother. Her reply was simply, \"Finally took you long enough!\" You have no idea what a relief that was. My mother continues to be my biggest supporter.\n\nI think perhaps the hardest part for me was coming out to my brothers. My older brother accepted me right away, but my younger brother had a little trouble doing the same. I am not sure why, but I think that my father may have had some deep influence on his perception of what homosexuality really is. In time, though, he has come to accept me. \n\nI know one thing that that really helped me was my GLBT youth support group. It sounds odd that there would be any support group for a GLBT person anywhere in Alabama, but I was shocked to find out there are actually a lot more than people think. The volunteers at GLBT Advocacy and Youth Services have provided so much care and support to me. Many who are GLBT themselves helped me to relate my issues with theirs. It is really comforting to know that someone else out there has had to go through what I am going though. I wholeheartedly wish that every GLBT youth in the nation had access to a group like them. Despite my struggle to be who I am, I know that I am a stronger, better person because of it.\n","id":"4dae1919d141b971c8000037","location_latlng":null,"age":"18"}},{"submission":{"name":"Tabbetha Murchison","created_at":"2011-05-09T08:00:00Z","location":"Garden City, Ga.","you_tube_video":"","images":[],"project_id":"4d94ab6d5556a36e69000001","story_title":"\"Every day feels like you are getting ready for war.\"","written_story":"When I first came to high school back in 2007, I thought it was going to be just like every other school that I had been to before. But in some degree, I was wrong; I am so grateful to have good friends and teachers, because without them, I don\u2019t know where I would be today, but here comes the reasons why school will always be what it is today.\n \nMajority of the issues that I faced as a lesbian student are major and minor issues.\nThe major issues that I have dealt with and am still dealing with consist of: Criticism, lack of people understanding, being gay-bashed, and some teachers not caring about homophobic remarks being used in their classrooms.\n         \nAs human beings, all of us deal with being criticized, but I feel like the LGBT teens, have it harder. We deal with being teased, criticized, and put down 10 times worse than our peers, which is why some of us hate going to school. It\u2019s too much to deal with, especially when it feels like the whole world, including your parents, is against you.\n \nEvery day feels like you are getting ready for war; you get up and get dressed and pray to God that no one messes with you, but they always do.  Instead of saying something, you don\u2019t because you don\u2019t want to give them the satisfaction of being right.  So you keep going to school and being quiet, because you\u2019re scared.  Your teachers hear the rude remarks being yelled out, but they don\u2019t say anything. They figure it\u2019s not their problem, until one day all that anger builds up inside of you and you explode.  Now they are paying attention.\n \nSometimes that is all it takes, and I did it plenty of times. I just wanted for me and my peers to be respected, and some teachers respected that and made sure of that, because they believed that everyone has the right to an education.\n \nSchool became my \u201csafe house,\u201d because the criticism wasn\u2019t just at school, it was at home too; my father is homophobic, he doesn\u2019t believe that I am living \u201cright.\u201d As much as I try not to let him get to me, he does.  He hasn\u2019t been the best father in the world to me. I still love him, but sometimes listening to what he has to say about me being a lesbian hurts. I wish he didn\u2019t feel that way about me.\n \nThe only thing that I ever wanted to do was to make him proud of me. The more I tried to be \u201cperfect,\u201d the more depressed I became; it was stressful and strenuous for me. Before I came out, I had become very depressed; I locked myself in my room. I gained weight and had to be hospitalized for chest pains that turned out to be a heart murmur. I was prescribed medicine that I take daily now.\n \nEventually I learned how not to let negative things get to me. Instead, I focused on all of the positive things that were happening in my life, because when I finally did come out; some of my pain went away. I stopped caring about what my dad and everybody else thought and said about me. I finally understood that they didn\u2019t understand, and that it\u2019s okay that there are people who don\u2019t understand. Those are the people who can be educated on LGBT issues, rights, and who we are, on a daily basis.\n \nIn school, I have good friends, teachers, and an awesome mentor, Ms.Hendrix: if it weren\u2019t for her, I don\u2019t know where I would be in life.\n       \nBut the day me and my best friend were gay-bashed, I cried, and I was angry and frustrated, because I knew exactly why we were attacked. We were just walking down the hallway, and some big guy ran up behind us and pushed us really hard into the floor and took off running before we could report him. My mother was furious and she wanted the school to pay for what had been done to me and my friend, but it\u2019s like I said earlier: school will always be what is now, and of course, nobody at school believed that the guy who hit us would do such a thing. My chest cavity was sore, and my friend\u2019s neck and head was sore.  It took us three days to recover.\n \nBut we did, and we are now stronger than ever and also now we are graduating seniors. This year, I got into shape and lost a total of 69 pounds.  At first, I lost the weight for myself, because I wanted to, but it actually turned into something bigger than just losing a few pounds. I had no clue that I was preparing myself for the military, and my backup plan is to go into the Navy.  \n \nAt first I was scared because of the military\u2019s old policy, \u201cdon\u2019t ask, don\u2019t tell.\u201d  I didn\u2019t want to have to go back into the closet; that just wasn\u2019t going to happen.  But I also knew that I had no way of paying for college, so I made it my priority to do something about DADT.  I voted and got everyone I knew to pay attention to what was going on, and I also got involved with The Gay and Lesbian Task Force. In the last couple of months, I had to be really careful of what I said, because my recruiter is on campus with me. Now that our President Obama has repealed that bill, I have a new look on life and a lot to talk about with my recruiter.\n \nThe one issue that gets under my skin is when teachers don\u2019t care about the amount of homophobia that is spread around their classrooms.  In my school, majority of the kids are black, so when somebody says the n-word, teachers get upset about it and tell us not to use that word, but it\u2019s okay for someone to yell words like \u201cgay.\u201d  It\u2019s just flabbergasting to me that teachers don\u2019t value racism and homophobia as it being the same thing, and it angers me, because I am a young black woman who happens to be a lesbian. So hearing every single one of those comments breaks my heart, and since teachers won\u2019t say anything, I stand up for myself and address my fellow peers who say ignorant things out of their mouths, especially when they are being stereotypical. I address them and I educate them, because if I don\u2019t then who will?\n         \nThe minor issues come from people who care, and also who have a lot of questions that bother me.  I\u2019m not a lab rat or an experiment, I\u2019m just a human being trying to make it in this world.   I don\u2019t ask for much. For the last four years of high school, I have been asked the same five questions that I like to call The Annoying Five: \n             1. Do your parents know/how do they feel about it?\n             2. How long have you known/what made you like girls?\n             3. Do you have a girlfriend?\n             4. Are you a virgin?\n             5. How do you have sex?\n \nNumbers 1-3 are questions that I have no problems answering, but numbers 4 and 5 are nobody\u2019s business, my  life is off-limits, I don\u2019t feel the need to answer those questions.\n \nBut to be nice, I answer numbers 1-3 by saying, yes, my parents know and they are fine with me being a lesbian; I have known that I was a lesbian for most of my life, and it\u2019s an attraction that I\u2019ve always had, God made me this way; and no, I\u2019m single.\n \nAs a student, I don\u2019t think that it is necessary for me to have to deal with all of these issues, because I don\u2019t come to school to be \u201cinterviewed\u201d by my classmates, I don\u2019t walk around school all day asking my peers about their personal life, or anything that makes them uncomfortable, so in return, it would be nice for my peers to return the favor.\n \nI am a human being just like everybody else, and once you get to know me, I can promise you that you won\u2019t want to stop knowing me, because I am lovable, fun, outrageous and encouraging.  Most of all of my friends tell me all the time that they don\u2019t know that they would do without me.  Not only do I get positive feedback from my friends, some adults and teachers as well tell me the same -- that I am brave and courageous for being me, and they hope that I never change.\n \nOne comment that I received came from my last year English teacher Mrs. Saunders, meant the world to me, because I had no idea that I had made a huge impact on her. She told me that she was ever so glad that I had landed in her class this year.\n \n\u201cSometimes as teachers, we find students who teach us, and not the other way around; from you I have learned courage, and seen strength beyond your average everyday teenagers.\u201d\n \nThat truly meant a lot to me, because if one person can look at me and be that positive about loving everyone as a whole, then why can\u2019t everybody in the whole world feel that way?","id":"4d9e2418d141b970f3000020","location_latlng":null,"age":"18"}}]}
        if (!data || !data.submissions) return;
        this.userStories = [];
        for (var i = 0; i < data.submissions.length; i++) {
            var sub = data.submissions[i].submission;
            var s = {};
            s.title = sub.story_title || "";
            s.text = sub.written_story || "";
            s.name = sub.name || "Anonymous";
            s.age = sub.age || "";
            s.location = sub.location || "";
            s.video = sub.you_tube_video || "";
            s.id = "user_story_" + i;
            s.type = NYTMM.ComingOut.STORY_TYPES.USER;
            if (s.video && s.video.indexOf("www.youtube.com") >= 0 && s.video.match(/v=\w+/i)) {
                try {
                    s.youTubeVideoId = s.video.match(/v=(\w+)/i)[1];
                } catch (e) {
                    s.youTubeVideoId = null;
                }
            }
            this.userStories.push(s);
            this.allStories.push(s);
        }
        this.storyMenu.buildUserList(this.userStories);
        NYTMM.LocationHash.checkInitialHash()
    },
    onStoryPlay: function (e) {
        var s = e.memo.story;
        if (!s) return;
        this.setStory(s);
    },
    onTwitClick: function (e) {
        var link = encodeURI(window.location);
        var story = this.storyScreen.getStory();
        var quote;
        if (story) {
            quote = (story.quote ? story.quote : story.title);
            quote = quote.replace(/<(.|\n)*?>/g, '')
            quote = quote.replace(/(&nbsp;| |\n)+/g, ' ')
            quote.slice(0, 100);
        } else {
            quote = ""
        }
        var status = encodeURI(quote + " @nytimes #comingout");
        status = status.replace(/#/g, '%23');
        link = link.replace(/#/g, '%23');
        NYTMM.log('http://twitter.com/share?text=' + status + '&url=' + link);
        window.open('http://twitter.com/share?text=' + status + '&url=' + link, 'twitterWindow');
    },
    onFBClick: function (e) {
        var link = encodeURI(window.location);
        link = link.replace(/#/g, '%23');
        NYTMM.log('http://www.facebook.com/sharer.php?u=' + link + '&t=the_title');
        window.open('http://www.facebook.com/sharer.php?u=' + link + '&t=the_title', 'fbWindow');
    },
    onHashChange: function () {
        NYTMM.log('Hash Changed');
        var hps = NYTMM.LocationHash.getHashParts()
        if (hps.length == 0) this.setState(NYTMM.ComingOut.STATES.MENU)
        else {
            var s = hps[0].toLowerCase();
            if (s == "readers") {
                this.showReaderStories();
            } else if (!this.checkState(s)) {
                this.setState(NYTMM.ComingOut.STATES.MENU);
            } else {
                this.setState(s);
            }
            if (hps.length > 1) {
                var p = hps[1].toLowerCase()
                if (this.state == NYTMM.ComingOut.STATES.STORY) this.storyScreen.setStory(this.getStoryById(p));
            }
        }
    },
    setState: function (s) {
        s = (s) ? s.toLowerCase() : "";
        if (this.state == s) return;
        var fromStory
        if (this.state == NYTMM.ComingOut.STATES.MENU) {
            this.storyMenu.setActive(false);
            this.layout.removeChild(this.storyMenu.layout);
        } else if (this.state == NYTMM.ComingOut.STATES.STORY) {
            fromStory = this.storyScreen.getStory();
            this.storyScreen.setActive(false);
            this.layout.removeChild(this.storyScreen.layout)
            this.storyScreen.showComment(null);
        }
        this.state = s;
        if (this.state == NYTMM.ComingOut.STATES.MENU) {
            this.layout.appendChild(this.storyMenu.layout);
            this.storyMenu.setActive(true);
            if (fromStory) {
                //this.storyMenu.scrollToStory(fromStory);
            }
        } else if (this.state == NYTMM.ComingOut.STATES.STORY) {
            this.layout.appendChild(this.storyScreen.layout);
            this.storyScreen.setActive(true);
        }
        this.topMenu.setState(this.state);
    },
    checkState: function (sid) {
        sid = (sid) ? sid.toLowerCase() : "";
        for (var s in NYTMM.ComingOut.STATES) {
            if (NYTMM.ComingOut.STATES[s] == sid) return true;
        }
        return false;
    },
    getStoryById: function (sid) {
        for (var i = 0; i < this.stories.length; i++) {
            if (this.stories[i].id == sid) return this.stories[i];
        }
        for (i = 0; i < this.userStories.length; i++) {
            if (this.userStories[i].id == sid) {
                return this.userStories[i];
            }
        }
        return null;
    },
    showMenu: function () {
        NYTMM.LocationHash.setHash("", true);
    },
    showReaderStories: function () {
        this.showMenu();
        this.storyMenu.scrollToItemAt(this.storyMenu.menuItems.length);
    },
    setStory: function (s) {
        if (!s) NYTMM.LocationHash.setHash("", true);
        else NYTMM.LocationHash.setHash(NYTMM.ComingOut.STATES.STORY + "/" + s.id, true);
    },
    nextStory: function () {
        if (this.state == NYTMM.ComingOut.STATES.MENU) {
            this.storyMenu.scrollToNext();
        } else if (this.state == NYTMM.ComingOut.STATES.STORY) {
            this.setStory(this.getNextStory());
        }
    },
    prevStory: function () {
        if (this.state == NYTMM.ComingOut.STATES.MENU) {
            this.storyMenu.scrollToPrev();
        } else if (this.state == NYTMM.ComingOut.STATES.STORY) {
            this.setStory(this.getPrevStory());
        }
    },
    getNextStory: function () {
        if (this.state == NYTMM.ComingOut.STATES.MENU) {
            return null;
        } else if (this.state == NYTMM.ComingOut.STATES.STORY) {
            var s = this.storyScreen.getStory();
            if (!s) return this.allStories[0];
            var si = this.allStories.indexOf(s) + 1;
            if (si >= 0 && si < this.allStories.length) {
                NYTMM.log('returning ' + si);
                return this.allStories[si];
            }
        }
        return null;
    },
    getPrevStory: function () {
        if (this.state == NYTMM.ComingOut.STATES.MENU) {
            return null;
        } else if (this.state == NYTMM.ComingOut.STATES.STORY) {
            var s = this.storyScreen.getStory();
            if (!s) return this.allStories[0];
            var si = this.allStories.indexOf(s);
            if (si > 0) return this.allStories[si - 1];
        }
        return null;
    }
});